* Added GetLocalHost() to Util

* ExternalHostName supports "SYSTEMIP" again.
This commit is contained in:
Adam Frisby
2007-07-30 21:12:29 +00:00
parent 74bb5282a0
commit e172e37c58
2 changed files with 28 additions and 1 deletions

View File

@@ -256,6 +256,26 @@ namespace OpenSim.Framework.Utilities
return null;
}
public static IPAddress GetLocalHost()
{
string dnsAddress = "localhost";
IPAddress[] hosts = Dns.GetHostEntry(dnsAddress).AddressList;
foreach (IPAddress host in hosts)
{
if (!IPAddress.IsLoopback(host) && host.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
{
return host;
}
}
if (hosts.Length > 0)
return hosts[0];
return null;
}
public Util()
{