perform a DNS query
perform a DNS query on a domain name using C Sharp
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());
}
}
}
Related posts:
- find the hostname for a known IP address find the hostname for a known IP address with C...
- Displays your IP address and hostname This example will display your IP address and hostname using...
- get ip address get ip address with VB.net Module Module1 Sub Main() Dim...
- free disk space This example shows how to display the free disk space,...
- free disk space, wmi version free disk space, wmi version with C Sharp using System;using...
Related posts brought to you by Yet Another Related Posts Plugin.






















