Group: Windows Sockets 2 (Winsock) - Library: ws2_32
Winsock: retrieving the host information corresponding to a network address
Retrieving the IP-to-physical address mapping table
Retrieving the interface–to–IP address mapping table
How to retrieve network parameters for the local computer (including Host name, Domain name, and DNS Server)
struct HOSTENT FAR * gethostbyaddr(
const char FAR *addr,
int len,
int type
);
DECLARE INTEGER gethostbyaddr IN ws2_32;
STRING addr,;
INTEGER len,;
INTEGER type
addr [in] Pointer to an address in network byte order.
len [in] Length of the address.
type [in] Type of the address, such as the AF_INET address family type (defined as TCP, UDP, and other associated Internet protocols). Address family types and their corresponding values are defined in the Winsock2.h header file.
If no error occurs, gethostbyaddr returns a pointer to the hostent structure. Otherwise, it returns a NULL pointer, and a specific error code can be retrieved by calling WSAGetLastError.
The gethostbyaddr function has been deprecated by the introduction of the getnameinfo function.