Platform SDK: Windows Sockets

gethostname Function in the SPI

The WSALookupServiceBegin query uses SVCID_HOSTNAME as the service class GUID. If lpszServiceInstanceName is NULL or references a NULL string (that is . ""), the local host is to be resolved. Otherwise, a lookup on a specified host name shall occur. For the purposes of emulating gethostname the Ws2_32.dll will specify a null pointer for lpszServiceInstanceName, and specify LUP_RETURN_NAME so that the host name is returned in the lpszServiceInstanceName parameter. If an application uses this query and specifies LUP_RETURN_ADDR then the host address will be provided in a CSADDR_INFO structure. The LUP_RETURN_BLOB action is undefined for this query. Port information will be defaulted to zero unless the lpszQueryString references a service such as ftp, in which case the complete transport address of the indicated service will be supplied.