CDnsClient::GetHostByAddress
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 unsigned long integer (32-bit value) 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 AF_INET 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 IP 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. For most applications it is recommended that the GetHostAddress and GetHostName methods be used instead.

Requirements

Client: Requires Windows Vista, Windows XP or Windows 2000 Professional.
Server: Requires Windows Server 2008, Windows Server 2003 or Windows 2000 Server.
Header: Include cstools6.h.
Library: Use csdnsav6.lib.
Unicode: Implemented as Unicode and ANSI versions.

See Also

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


Copyright © 2008 Catalyst Development Corporation. All rights reserved.