Search This Blog

Thursday, December 18, 2014

Dns Get Host By Name C# Example

C# > System.Net > Dns

Retrieves information about a specific host from the Internet Domain Name System (DNS).

Example

  IPHostEntry hostInfo = Dns.GetHostByName("www.microsoft.com");
  string hostName = hostInfo.HostName;
  IPAddress[] addressList = hostInfo.AddressList;
  foreach (IPAddress ipAddress in addressList)
  {
              

  }