Showing posts with label IP Address. Show all posts
Showing posts with label IP Address. Show all posts

Tuesday, December 28, 2010

method for getting all IP addresses

public static string GetIPAddress()
{

String strHostName = string.Empty;
strHostName = Dns.GetHostName();
IPHostEntry ipEntry = Dns.GetHostEntry(strHostName);
IPAddress[] addr = ipEntry.AddressList;
string IPAddress=string.Empty;
for (int i = 0; i < addr.Length; i++)
{
IPAddress = addr[1].ToString();
}
return IPAddress;
}