Use hostname instead of the ip.
This commit is contained in:
1 parent
9d73d6b532
commit
d9b8d54eb9
1 file changed
+4
-2
@@ -205,13 +205,15 @@ namespace ServerLib
|
|||||||
|
|
||||||
public static string GetLocalAddress()
|
public static string GetLocalAddress()
|
||||||
{
|
{
|
||||||
IPAddress[] ips = Dns.GetHostAddresses(Dns.GetHostName());
|
return Dns.GetHostName();
|
||||||
|
|
||||||
|
/*IPAddress[] ips = Dns.GetHostAddresses(Dns.GetHostName());
|
||||||
foreach (IPAddress ip in ips)
|
foreach (IPAddress ip in ips)
|
||||||
{
|
{
|
||||||
if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
|
if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
|
||||||
return ip.ToString();
|
return ip.ToString();
|
||||||
}
|
}
|
||||||
return "";
|
return "";*/
|
||||||
}
|
}
|
||||||
|
|
||||||
#region server control
|
#region server control
|
||||||
|
|||||||
Reference in new issue
Block a user