3
Vote

IPv6 Issue with Windows 7.

description

Similar to http://mpapi.codeplex.com/WorkItem/View.aspx?WorkItemId=9856.
 
The issue surrounds resolving the correct IPv4 address of the Registration Server.
 
File: MPAPI/Node.cs
Line: 160 approx.
Function: OpenAndConnectToRegistrationServer
Specifics: Hard Coded "Magic Number" for accessing the address in the Array from "Dns.GetHostEntry(..);"
Code:
 
"
IPEndPoint registrationServerEndPoint =
new IPEndPoint(Dns.GetHostEntry(registrationServerNameOrAddress).AddressList[0], registrationServerPort);
"
 
The first address i.e. AddressList[0] is IPv6.
 
Work Around:
Select the first non-IPv6 Address with something like...
 
"
IPAddress[] addressList = Dns.GetHostEntry(registrationServerNameOrAddress).AddressList;
 
//Find the first IP that is not IPv6
int ipv4 = 0;
foreach (var e in addressList)
{
if (e.IsIPv6LinkLocal)
{
    ipv4++;
}
}
var address = addressList[ipv4];
"

comments

holsee wrote Dec 3, 2009 at 1:14 PM

Issue posted in RemotingLite Issue Tracker: http://remotinglite.codeplex.com/WorkItem/View.aspx?WorkItemId=6469

Same issue exists directly inside the RemotingLite ServiceHost class.

File: ServiceHost.cs
Line: 118 (approx)
Code: Magic number used to access IPAddress from a list
"
        IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
        _endPoint = new IPEndPoint(hostEntry.AddressList[3], port);
"
Resolution: Select first non IPv6 Address with something like...

"
        //Find the first IP that is not IPv6
        int ipv4 = 0;
        foreach (var e in addressList)
        {
            if (e.IsIPv6LinkLocal)
            {
                ipv4++;
            }
        }
        var address = hostEntry.AddressList[ipv4];
"

wrote Mar 4, 2010 at 8:14 PM

wrote Jul 26, 2010 at 4:03 AM

wrote Feb 14, 2013 at 1:37 AM