gethostbyaddr Function in the API

The gethostbyaddr function uses the WSALookupServiceBegin function to query SVCID_INET_HOSTNAMEBYADDR as the service class GUID. The host address is supplied as a dotted decimnal IPv4 string (for example, "192.9.200.120") in the lpszServiceInstanceName member of the WSAQUERYSET structure passed to the WSALookupServiceBegin function. The Ws2_32.dll specifies LUP_RETURN_BLOB and the name service provider places a HOSTENT structure in the blob (using offsets instead of pointers as described above). Name service providers should honor these other LUP_RETURN_* flags as well.

Flag Description
LUP_RETURN_NAME Returns the h_name member from HOSTENT structure in lpszServiceInstanceName.
LUP_RETURN_ADDR Returns addressing information from HOSTENT in CSADDR_INFO structures, port information is defaulted to zero.

 

Compatible Name Resolution for TCP/IP in the Windows Sockets 1.1 API

Protocol-Independent Name Resolution

Registration and Name Resolution