gethostbyname Function in the API

The gethostbyname function uses the WSALookupServiceBegin function to query SVCID_INET_HOSTADDRBYNAME as the service class GUID. The host name is supplied in the lpszServiceInstanceName member in 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 the HOSTENT structure in lpszServiceInstanceName.
LUP_RETURN_ADDR Returns addressing information from HOSTENT in CSADDR_INFO structures, port information is defaulted to zero. Note that this routine does not resolve host names that consist of a dotted IPv4 address.

 

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

Protocol-Independent Name Resolution

Registration and Name Resolution