Resolve a Host name : DNS : Network C# Examples


C# Examples » Network » DNS »

 

Resolve a Host name









    
using  System;
using  System.Net;

class  MainClass
{
      public  static  void  Main(string[]  argv)
      {
            IPHostEntry  iphe  =  Dns.Resolve("62.208.12.1");

            Console.WriteLine("Host  name:  {0}",  iphe.HostName);
            foreach(string  alias  in  iphe.Aliases)
            {
                  Console.WriteLine("Alias:  {0}",  alias);
            }
            foreach(IPAddress  address  in  iphe.AddressList)
            {
                  Console.WriteLine("Address:  {0}",
                                          address.ToString());
            }
      }
}
    
   
  
   



Output

Host name: 62.208.12.1
Address: 62.208.12.1


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Network
» DNS