Mega Code Archive

 
Categories / C# Tutorial / Network
 

Get Host by IP address

using System; using System.Net; class MainClass {    public static void Main(string[] argv)    {       IPAddress test = IPAddress.Parse("64.200.123.1");       IPHostEntry iphe = Dns.GetHostByAddress(test);       Console.WriteLine("Information for {0}", test.ToString());       Console.WriteLine("Host name: {0}", iphe.HostName);    } } Information for 64.200.123.1 Host name: drvlga1wct1-atm1-0-0-12.wcg.net