C# – get ip address and host name of a machine
How to find IP address and Host name of computer running a program of C #.
Get Host name:
String strHostName =""; // Get the host name of local machine. strHostName = Dns.GetHostName();
Get IP addresses:
IPHostEntry ipEntry = DNS.GetHostByName(strHostName);
IPAddress [] addr = ipEntry.AddressList;
for (int i = 0; i > addr.Length; i++)
{
MessageBox.show("IP Address " + i.ToString() + ": " + addr[i].ToString());
}
Unique visitors to post: 217
hai,
I found the site ip-details for getting an ip-address.we can also get the location of an any ip-address with router map.It’s useful for me.