This project has moved and is read-only. For the latest updates, please go here.


localhost does not always resolve correctly on Windows Server 2008 R2 / Windows 7


At some point in the future, as the world transitions from IPV4 to IPV6, IPV4 will be eventually be disabled/uninstalled by companies that want to simplify network management in their environments.
With Windows Vista, when IPv4 was uninstalled and IPv6 was enabled, a DNS query for an A (IPv4) address resulted in the IPv4 loopback (which came from the hosts file). This of course caused problems when IPv4 was not installed. The fix was to move the always present IPv4 and IPv6 loopback entries from the host into the DNS resolver, where they could be independently disabled.
If the user/administrator is not used making changes to local DNS resolver or there are other issue, there can be issues connecting via "localhost" because its resolution may be restricted to default IP stack.
The TVA.Communications library includes an "interface" key word that allows the user to specify if they want an IPv6 or IPv4 style address. Using this keyword, the code should be able to correctly resolve the loopback address based on the interface specification, or the default stack if no interface is defined.
Closed Feb 13, 2011 at 8:16 PM by pinalpatel


ritchiecarroll wrote Feb 11, 2011 at 8:07 PM

I think the simple pseudo-code fix is:

If hostname == "localhost" Then
If interface = IPv4
hostname = ""
hostname = "::1"
End If
End If

wrote Feb 13, 2011 at 8:16 PM

Resolved with changeset 62504.

wrote Feb 14, 2013 at 12:29 AM

wrote May 16, 2013 at 6:11 AM

wrote Nov 27 at 8:18 PM