This function can also be used to convert an address in dot
notation to a binary format. If the function must perform a DNS
lookup to resolve the hostname, the calling thread will block. To
ensure future compatibility with IPv6 networks, it is important
that the application does not make any assumptions about the format
of the address. If the function returns successfully, the
ipFamily member of the INTERNET_ADDRESS structure
should always be checked to determine the type of address.
The nAddressFamily parameter is used to specify a
preference for the type of address returned, however it is possible
that a host may not have an IPv4 or IPv6 address record, in which
case this function will fail. Although IPv4 is still the most
common address used at this time, an application should not assume
that because a given host name does not have an IPv4 address, that
the host name is invalid.
If the nAddressFamily parameter is specified as
INET_ADDRESS_UNKNOWN, the application must be prepared to handle
IPv6 addresses because it is possible for a host name to have an
IPv6 address assigned to it and no IPv4 address. For legacy
applications that only recognize IPv4 addresses, the
nAddressFamily member should always be specified as
INET_ADDRESS_IPV4 to ensure that only IPv4 addresses are
returned.
To determine if the local system has an IPv6 TCP/IP stack
installed and configured on the local system, use the
InetIsProtocolAvailable function. If an IPv6 stack is not
installed, this function will fail if the lpszHostName
parameter specifies an host that only has an IPv6 (AAAA) DNS
record.