aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/NetworkUtil.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/NetworkUtil.cs')
-rw-r--r--OpenSim/Framework/NetworkUtil.cs14
1 files changed, 11 insertions, 3 deletions
diff --git a/OpenSim/Framework/NetworkUtil.cs b/OpenSim/Framework/NetworkUtil.cs
index 1abf0d8..759c52f 100644
--- a/OpenSim/Framework/NetworkUtil.cs
+++ b/OpenSim/Framework/NetworkUtil.cs
@@ -1,4 +1,5 @@
1using System.Collections.Generic; 1using System;
2using System.Collections.Generic;
2using System.Net.Sockets; 3using System.Net.Sockets;
3using System.Net; 4using System.Net;
4using System.Net.NetworkInformation; 5using System.Net.NetworkInformation;
@@ -65,8 +66,15 @@ namespace OpenSim.Framework
65 return subnet.Key; 66 return subnet.Key;
66 } 67 }
67 68
68 // None found. Assume outside network. 69 // Check to see if we can find a IPv4 address.
69 return null; 70 foreach (IPAddress host in Dns.GetHostAddresses(defaultHostname))
71 {
72 if (host.AddressFamily == AddressFamily.InterNetwork)
73 return host;
74 }
75
76 // Unable to find anything.
77 throw new ArgumentException("[NetworkUtil] Unable to resolve defaultHostname to an IPv4 address for an IPv4 client");
70 } 78 }
71 79
72 static NetworkUtil() 80 static NetworkUtil()