CDnsClient::GetHostByAddress Method  
 
LPHOSTENT GetHostByAddress(
  LPVOID lpvAddress,  
  INT cbAddress,  
  INT nAddressFamily  
);

The GetHostByAddress method returns a pointer to a HOSTENT structure which contains the results of a successful search for the host specified by address parameter.

Parameters

lpvAddress
Pointer to an integer IPv4 address in network byte order.
cbAddress
The length of the address in bytes; this value should always be 4.
nAddressFamily
The type of address being resolved; this value should always be DNS_ADDRESS_IPV4 as defined in the Windows Sockets header file.

Return Value

If the method succeeds, the return value is a pointer to a HOSTENT structure. If the method fails, the return value is NULL. To get extended error information, call GetLastError.

Remarks

The application must never attempt to modify this structure or to free any of its components. Only one copy of this structure is allocated per thread, so the application should copy any information it needs before issuing any other function calls. To convert an IPv4 address string in dotted notation to a 32-bit IP address, use the GetAddress method.

This method is included for compatibility with existing applications which already use the HOSTENT structure. Because this method returns a pointer to a complex structure, it may not be suitable for some programming languages.

This method is not compatible with IPv6 addresses. For applications that must support both IPv4 and IPv6 address formats, use the GetHostAddress and GetHostName methods.

Requirements

Minimum Desktop Platform: Windows 7 (Service Pack 1)
Minimum Server Platform: Windows Server 2008 R2 (Service Pack 1)
Header File: cstools10.h
Import Library: csdnsv10.lib
Unicode: Implemented as Unicode and ANSI versions.

See Also

GetHostAddress, GetHostByName, GetHostInfo, GetHostName, GetHostServices, GetRecord, GetResolverAddress, RegisterServer