DnsGetAddress Function  
 
INT WINAPI DnsGetAddress(
  LPCTSTR lpszAddress,  
  INT nAddressFamily,  
  LPINTERNET_ADDRESS lpAddress  
);

The DnsGetAddress function converts an address string to a numeric IPv4 or IPv6 address.

Parameters

lpszAddress
A pointer to a null-terminated string which specifies an IPv4 address in dotted notation.
nAddressFamily
An integer value which specifies the type of IP address. If this parameter is zero, the address family will be determined automatically based on the format of the address string. If this parameter is AF_INET, the address must be in IPv4 format, and if it is AF_INET6, the address must be in IPv6 format.
lpAddress
A pointer to an INTERNET_ADDRESS structure that will contain the numeric form of the IPv4 or IPv6 address in network byte order when the function returns.

Return Value

If the function succeeds, the return value is the address family for the IP address. If the function fails, the return value is DNS_ERROR. To get extended error information, call DnsGetLastError.

Remarks

This function will only accept a string that is in the proper format for an IP address, and cannot be used to resolve a host name. To perform host name resolution, use the DnsGetHostAddress function. To convert a numeric address to an address string, use the DnsFormatAddress function.

Requirements

Client: Requires Windows 7, Windows Vista or Windows XP.
Server: Requires Windows Server 2008 or Windows Server 2003.
Header: Include cstools7.h.
Library: Use csdnsav7.lib.
Unicode: Implemented as Unicode and ANSI versions.

See Also

DnsFormatAddress, DnsGetHostAddress, DnsGetHostInfo, DnsGetHostServices, DnsGetMailExchange, DnsGetRecord, INTERNET_ADDRESS