Get IPHostEntry by host name : DNS « Network « C# / CSharp Tutorial






using System;
using System.Net;

class MainClass
{
   public static void Main(string[] argv)
   {
      IPHostEntry results = Dns.GetHostByName("www.java2s.com");

      Console.WriteLine("Host name: {0}",results.HostName);

      foreach(string alias in results.Aliases)
      {
         Console.WriteLine("Alias: {0}", alias);
      }
      foreach(IPAddress address in results.AddressList)
      {
         Console.WriteLine("Address: {0}",
                     address.ToString());
      }
   }
}
Host name: java2s.com
Alias: www.java2s.com
Address: 68.178.206.138








33.2.DNS
33.2.1.DNS Name and Its IPHostEntry
33.2.2.Get DNS host name
33.2.3.Get IP address from host name
33.2.4.Get Host by IP address
33.2.5.Get IPAddress from IPHostEntry
33.2.6.Get IPHostEntry by host name
33.2.7.Resolve a Host name
33.2.8.Get Address List from HostEntry
33.2.9.Use AsyncCallback event to resolve a host name
33.2.10.Dns Lookup