The gethostbyname function unexpectedly returns the IP addresses in numeric order on a Windows Vista-based computer or on a Windows Server 2008-based computer
Consider the following scenario:
- You are running a Windows Vista-based computer or a Windows Server 2008-based computer.
- The computer has multiple IP addresses.
- You run the gethostbyname function.
In this scenario, the gethostbyname function returns the IP addresses in numeric order. Therefore, the IP address that has the lowest number is returned first. You expect the primary IP address to be returned first.
For more information on this issue, including potential causes, workarounds, and resolutions, see: Microsoft KB Article KB948505.