Navigation

perform a DNS query

 

using System;
using System.Net;
class GetDnsInfo
{
public static void Main(string[] argv)
{
if (argv.Length != 1)
{
Console.WriteLine("Usage: GetDnsInfo hostname");
return;
}
IPHostEntry results = Dns.GetHostByName(argv[0]);
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());
}
}
}

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay

Related posts:

  1. get ip address get ip address Module Module1 Sub Main() Dim h As...
  2. get the Windows XP product serial number get the Windows XP product serial number using System; using...
  3. Get your IP address Module Module1 Sub Main() Dim h As System.Net.IPHostEntry = System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName)...
  4. get ip address Module Module1 Sub Main() Dim h As System.Net.IPHostEntry = System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName)...
  5. network information using WMI network information using WMI Cls $strComputer = “.” $colItems =...

Related posts brought to you by Yet Another Related Posts Plugin.

You must be logged in to post a comment.