diff options
author | Adam Frisby | 2007-07-30 21:12:29 +0000 |
---|---|---|
committer | Adam Frisby | 2007-07-30 21:12:29 +0000 |
commit | e172e37c58c1d4ab48e3dcccacb8707c25e0d2bf (patch) | |
tree | 44b75ae525cf5b4da3ef1baec3dc8d21f772277e /OpenSim/Framework/General/Util.cs | |
parent | mass update of files to have native line endings (diff) | |
download | opensim-SC_OLD-e172e37c58c1d4ab48e3dcccacb8707c25e0d2bf.zip opensim-SC_OLD-e172e37c58c1d4ab48e3dcccacb8707c25e0d2bf.tar.gz opensim-SC_OLD-e172e37c58c1d4ab48e3dcccacb8707c25e0d2bf.tar.bz2 opensim-SC_OLD-e172e37c58c1d4ab48e3dcccacb8707c25e0d2bf.tar.xz |
* Added GetLocalHost() to Util
* ExternalHostName supports "SYSTEMIP" again.
Diffstat (limited to 'OpenSim/Framework/General/Util.cs')
-rw-r--r-- | OpenSim/Framework/General/Util.cs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/OpenSim/Framework/General/Util.cs b/OpenSim/Framework/General/Util.cs index bbee4b2..9e687ba 100644 --- a/OpenSim/Framework/General/Util.cs +++ b/OpenSim/Framework/General/Util.cs | |||
@@ -256,6 +256,26 @@ namespace OpenSim.Framework.Utilities | |||
256 | return null; | 256 | return null; |
257 | } | 257 | } |
258 | 258 | ||
259 | public static IPAddress GetLocalHost() | ||
260 | { | ||
261 | string dnsAddress = "localhost"; | ||
262 | |||
263 | IPAddress[] hosts = Dns.GetHostEntry(dnsAddress).AddressList; | ||
264 | |||
265 | foreach (IPAddress host in hosts) | ||
266 | { | ||
267 | if (!IPAddress.IsLoopback(host) && host.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) | ||
268 | { | ||
269 | return host; | ||
270 | } | ||
271 | } | ||
272 | |||
273 | if (hosts.Length > 0) | ||
274 | return hosts[0]; | ||
275 | |||
276 | return null; | ||
277 | } | ||
278 | |||
259 | public Util() | 279 | public Util() |
260 | { | 280 | { |
261 | 281 | ||