You've already forked linux-packaging-mono
Imported Upstream version 5.0.0.42
Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
parent
1190d13a04
commit
6bdd276d05
@@ -71,7 +71,12 @@ namespace System.Runtime.Remoting.Channels.Tcp
|
||||
else {
|
||||
IPHostEntry he = Dns.Resolve (Dns.GetHostName());
|
||||
if (he.AddressList.Length == 0) throw new RemotingException ("IP address could not be determined for this host");
|
||||
host = he.AddressList [0].ToString ();
|
||||
AddressFamily addressFamily = (Socket.OSSupportsIPv4) ? AddressFamily.InterNetwork : AddressFamily.InterNetworkV6;
|
||||
IPAddress addr = GetMachineAddress (he, addressFamily);
|
||||
if (addr != null)
|
||||
host = addr.ToString ();
|
||||
else
|
||||
host = he.AddressList [0].ToString ();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -259,6 +264,22 @@ namespace System.Runtime.Remoting.Channels.Tcp
|
||||
server_thread.Join ();
|
||||
server_thread = null;
|
||||
}
|
||||
|
||||
private static IPAddress GetMachineAddress (IPHostEntry host, AddressFamily addressFamily)
|
||||
{
|
||||
IPAddress result = null;
|
||||
if (host != null) {
|
||||
IPAddress[] addressList = host.AddressList;
|
||||
for (int i = 0; i < addressList.Length; i++) {
|
||||
if (addressList[i].AddressFamily == addressFamily) {
|
||||
result = addressList[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
class ClientConnection
|
||||
|
||||
Reference in New Issue
Block a user