aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/General/Util.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/General/Util.cs')
-rw-r--r--OpenSim/Framework/General/Util.cs20
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