Get Host by IP adress

Shows how to retrieve the hostname from a given IP adress.

Snippet information

Author:
Jonas John

License:
Public domain

Language:
C#

Created:
08/09/2007

Updated:
08/09/2007

Tags:
, , ,


string IPAdress = "127.0.0.1";
 
IPHostEntry IPHostEntryObject = Dns.GetHostEntry(IPAdress);
 
Console.WriteLine(IPHostEntryObject.HostName);


Found a bug? Or do you have a better solution for this?
Feel free to leave a message:

Add a comment


Leave a comment