take the first network ip. how can we be sure that this one is the right one?

This commit is contained in:
Alexander Eckart authored and Florian Küpper committed 2013-12-26 13:03:21 +01:00
1 parent deabae991a
commit e2986c0f46
1 file changed
+2 -3
+2 -3
View File
@@ -206,13 +206,12 @@ namespace ServerLib
public static string GetLocalAddress()
{
IPAddress[] ips = Dns.GetHostAddresses(Dns.GetHostName());
string IPAddress = "";
foreach (IPAddress ip in ips)
{
if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
IPAddress = ip.ToString();
return ip.ToString();
}
return IPAddress;
return "";
}
#region server control