IPAddress[] localIPs = Dns.GetHostAddresses(Dns.GetHostName());
//string MyIp = localIPs[localIPs.Length - 2].ToString();
string MyIp = "";
for (int i = 0; i < localIPs.Length; i++)
{
if (localIPs[i].AddressFamily == AddressFamily.InterNetwork)
{
MyIp = localIPs[i].ToString();
}
}
return MyIp;
0 comments:
Post a Comment