Moved local ip to library

This commit is contained in:
2015-10-20 22:48:40 +02:00
parent b75083be83
commit 3cc8b70009
+15
View File
@@ -99,5 +99,20 @@ namespace ErgometerLibrary
return ip; return ip;
} }
public static IPAddress GetIP()
{
IPHostEntry host;
string localIP = "?";
host = Dns.GetHostEntry(Dns.GetHostName());
foreach (IPAddress ip in host.AddressList)
{
if (ip.AddressFamily == AddressFamily.InterNetwork)
{
localIP = ip.ToString();
}
}
return GetIP(localIP);
}
} }
} }