diff options
author | Adam Frisby | 2007-07-18 21:55:24 +0000 |
---|---|---|
committer | Adam Frisby | 2007-07-18 21:55:24 +0000 |
commit | 11efebd29ee264402117f0a98b460b7aff23d369 (patch) | |
tree | db448ada6267716e800947e4f45b131ba40a4970 /OpenSim/Framework/General/Util.cs | |
parent | A script/custom application should be able to add a particle system to a prim... (diff) | |
download | opensim-SC_OLD-11efebd29ee264402117f0a98b460b7aff23d369.zip opensim-SC_OLD-11efebd29ee264402117f0a98b460b7aff23d369.tar.gz opensim-SC_OLD-11efebd29ee264402117f0a98b460b7aff23d369.tar.bz2 opensim-SC_OLD-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/Util.cs')
-rw-r--r-- | OpenSim/Framework/General/Util.cs | 25 |
1 files changed, 25 insertions, 0 deletions
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 | */ |
28 | using System; | 28 | using System; |
29 | using System.Security.Cryptography; | 29 | using System.Security.Cryptography; |
30 | using System.Net; | ||
30 | using System.Text; | 31 | using System.Text; |
31 | using libsecondlife; | 32 | using 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 | ||