diff --git a/ErgometerLibrary/NetHelper.cs b/ErgometerLibrary/NetHelper.cs index 3a3faf9..6d65046 100644 --- a/ErgometerLibrary/NetHelper.cs +++ b/ErgometerLibrary/NetHelper.cs @@ -99,5 +99,20 @@ namespace ErgometerLibrary 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); + } } }