From 9ff5bb9873e41936ef3ddb6fcea2f0529e425e52 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Mon, 2 Jul 2007 06:57:42 +0000 Subject: * Applied Weathros/tedd's IP v6 patch --- OpenSim/Framework/General/Types/RegionInfo.cs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/OpenSim/Framework/General/Types/RegionInfo.cs b/OpenSim/Framework/General/Types/RegionInfo.cs index 69a941e..7b99d06 100644 --- a/OpenSim/Framework/General/Types/RegionInfo.cs +++ b/OpenSim/Framework/General/Types/RegionInfo.cs @@ -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); } } -- cgit v1.1