* Applied Weathros/tedd's IP v6 patch

Sugilite
lbsa71 2007-07-02 06:57:42 +00:00
parent d78f6505e3
commit 9ff5bb9873
1 changed files with 19 additions and 1 deletions

View File

@ -55,7 +55,25 @@ namespace OpenSim.Framework.Types
{
get
{
return new IPEndPoint( Dns.GetHostAddresses( m_externalHostName )[0], m_internalEndPoint.Port );
// Old one defaults to IPv6
//return new IPEndPoint( Dns.GetHostAddresses( m_externalHostName )[0], m_internalEndPoint.Port );
// New method favors IPv4
IPAddress ia = null;
foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName))
{
if (ia == null)
ia = Adr;
if (Adr.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
{
ia = Adr;
break;
}
}
return new IPEndPoint(ia, m_internalEndPoint.Port);
}
}