Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The gethostname function uses the WSALookupServiceBegin function to query SVCID_HOSTNAME as the service class GUID. If the lpszServiceInstanceName member of the WSAQUERYSET structure passed to the WSALookupServiceBegin function is NULL or references a NULL string (that is . ""), the local host is to be resolved. Otherwise, a lookup on a specified host name occurs. For the purposes of emulating gethostname the Ws2_32.dll specifies a NULL pointer for the lpszServiceInstanceName member, and specifies LUP_RETURN_NAME so that the host name is returned in the lpszServiceInstanceName member. If an application uses this query and specifies LUP_RETURN_ADDR then the host address is provided in a CSADDR_INFO structure. The LUP_RETURN_BLOB action is undefined for this query. Port information is defaulted to zero unless the lpszQueryString member of the WSAQUERYSET structure passed to the WSALookupServiceBegin function references a service such as FTP, in which case the complete transport address of the indicated service is supplied.
Related topics