aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/General
diff options
context:
space:
mode:
authorAdam Frisby2007-07-18 21:55:24 +0000
committerAdam Frisby2007-07-18 21:55:24 +0000
commit11efebd29ee264402117f0a98b460b7aff23d369 (patch)
treedb448ada6267716e800947e4f45b131ba40a4970 /OpenSim/Framework/General
parentA script/custom application should be able to add a particle system to a prim... (diff)
downloadopensim-SC-11efebd29ee264402117f0a98b460b7aff23d369.zip
opensim-SC-11efebd29ee264402117f0a98b460b7aff23d369.tar.gz
opensim-SC-11efebd29ee264402117f0a98b460b7aff23d369.tar.bz2
opensim-SC-11efebd29ee264402117f0a98b460b7aff23d369.tar.xz
* Added "GetHostFromDNS" to Util to replace the various DNS resolution methods we use. Favours IPv4 addresses before IPv6 addresses to work around the Vista preference issue.
Diffstat (limited to 'OpenSim/Framework/General')
-rw-r--r--OpenSim/Framework/General/Types/RegionInfo.cs2
-rw-r--r--OpenSim/Framework/General/Util.cs25
2 files changed, 26 insertions, 1 deletions
diff --git a/OpenSim/Framework/General/Types/RegionInfo.cs b/OpenSim/Framework/General/Types/RegionInfo.cs
index c347918..251d7f8 100644
--- a/OpenSim/Framework/General/Types/RegionInfo.cs
+++ b/OpenSim/Framework/General/Types/RegionInfo.cs
@@ -212,7 +212,7 @@ namespace OpenSim.Framework.Types
212 212
213 string internalAddress = GetString(configData, "InternalIPAddress", "0.0.0.0", "Internal IP Address for UDP client connections").ToString(); 213 string internalAddress = GetString(configData, "InternalIPAddress", "0.0.0.0", "Internal IP Address for UDP client connections").ToString();
214 int internalPort = GetIPPort(configData, "InternalIPPort", "9000", "Internal IP Port for UDP client connections"); 214 int internalPort = GetIPPort(configData, "InternalIPPort", "9000", "Internal IP Port for UDP client connections");
215 IPAddress internalIPAddress = Dns.GetHostByName(internalAddress).AddressList[0]; 215 IPAddress internalIPAddress = Util.GetHostFromDNS(internalAddress);
216 m_internalEndPoint = new IPEndPoint(internalIPAddress, internalPort); 216 m_internalEndPoint = new IPEndPoint(internalIPAddress, internalPort);
217 217
218 m_externalHostName = GetString(configData, "ExternalHostName", "127.0.0.1", "External Host Name"); 218 m_externalHostName = GetString(configData, "ExternalHostName", "127.0.0.1", "External Host Name");
diff --git a/OpenSim/Framework/General/Util.cs b/OpenSim/Framework/General/Util.cs
index 3333ced..97fe7da 100644
--- a/OpenSim/Framework/General/Util.cs
+++ b/OpenSim/Framework/General/Util.cs
@@ -27,6 +27,7 @@
27*/ 27*/
28using System; 28using System;
29using System.Security.Cryptography; 29using System.Security.Cryptography;
30using System.Net;
30using System.Text; 31using System.Text;
31using libsecondlife; 32using libsecondlife;
32 33
@@ -176,6 +177,30 @@ namespace OpenSim.Framework.Utilities
176 177
177 return output.ToString(); 178 return output.ToString();
178 } 179 }
180
181 /// <summary>
182 /// Returns a IP address from a specified DNS, favouring IPv4 addresses.
183 /// </summary>
184 /// <param name="dnsAddress">DNS Hostname</param>
185 /// <returns>An IP address, or null</returns>
186 public static IPAddress GetHostFromDNS(string dnsAddress)
187 {
188 IPAddress[] hosts = Dns.GetHostEntry(dnsAddress).AddressList;
189
190 foreach (IPAddress host in hosts)
191 {
192 if (host.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
193 {
194 return host;
195 }
196 }
197
198 if (hosts.Length > 0)
199 return hosts[0];
200
201 return null;
202 }
203
179 public Util() 204 public Util()
180 { 205 {
181 206