Get DNS Address Info : DNS « Network « C# / C Sharp






Get DNS Address Info

 

using System;
using System.Net;

public class GetDNSAddressInfo {
   public static void Main(string[] argv) {
      if (argv.Length != 1) {
         Console.WriteLine("Usage: GetDNSAddressInfo address");
         return;
      }

      IPAddress test = IPAddress.Parse(argv[0]);

      IPHostEntry iphe = Dns.GetHostByAddress(test);

      Console.WriteLine("Information for {0}",
                     test.ToString());

      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());
      }
   }
}

           
         
  








Related examples in the same category

1.DNS Reverse Lookup and Lookup
2.DNS Name Resolution
3.DNS Get Host By NameDNS Get Host By Name
4.Find DNS Servers
5.Get Resolve Info:DNSGet Resolve Info:DNS
6.Get DNS Host InfoGet DNS Host Info
7.DNS Address ResolverDNS Address Resolver
8.Find DNS Servers from Registry
9.Get Dns Server