1

I have a client in Windows 8 (RT) and I have an instance of HostName given by the user which can be either IPv4 or DomainName. Now for IPv4, it's OK but for DomainName it is not OK since it tries to connect using IPv6 and no app in the server is serving clients on IPv6 (just IPv4) so I am looking for a way to get the IPv4 of that DomainName and then try to connect.

EDIT: I want it in Windows 8 (RT) SDK not regular .net

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Peyman
  • 3,059
  • 1
  • 33
  • 68

1 Answers1

3
string host = "www.stackoverflow.com";
System.Net.IPAddress ip = System.Net.Dns.GetHostAddresses(host)[0];
Steve
  • 20,703
  • 5
  • 41
  • 67