2
Vote

Issue Resolving Correct IPv4 Address in Windows 7 (IPv6 Issue)

description

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);
"
Suggested 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];
"
 
Also See MPAPI: http://mpapi.codeplex.com/WorkItem/View.aspx?WorkItemId=15156

comments