Get IPHostEntry by host name : DNS : Network C# Examples


C# Examples » Network » DNS »

 

Get IPHostEntry by host name









    
using  System;
using  System.Net;

class  MainClass
{
      public  static  void  Main(string[]  argv)
      {
            IPHostEntry  results  =  Dns.GetHostByName("www.navioo.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());
            }
      }
}
    
   
  
   



Output

Host name: navioo.com
Alias: www.navioo.com
Address: 68.178.206.138


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Network
» DNS