I'm using a third party library suite that was stupidly hard-coded to call GetHostEntry.AddressList[0] for a local IP address. It is also not written to support IPv6. I disabled IPv6 on all my network interfaces, but AddressList[0] in my test program (and in the 3rd party libraries) still returns {::1} rather than my first IPv4 address. Is there any Windows setting I can change to fix this so that it behaves like Windows XP (which returns the first IPv4 address)?
Here is the test program I'm using to verify the behavior:
class Program
{
static void Main(string[] args)
{
List<string> addresses = ( from address in Dns.GetHostEntry(Dns.GetHostName()).AddressList select address.ToString() ).ToList();
foreach (string a in addresses)
{
Console.WriteLine(a);
}
Console.Read();
}
}
On a Windows XP machine, the output of the program is 192.168.56.1
On my Windows 7 machine, the output of the program is ::1 192.168.56.2
Any suggestions? Changing the third party library code is not an option available to me.