getservbyname and getservbyport Functions in the API

The getservbyname and getservbyport functions use the WSALookupServiceBegin function to query SVCID_INET_SERVICEBYNAME as the service class GUID. The lpszServiceInstanceName member in the WSAQUERYSET structure passed to the WSALookupServiceBegin function references a string to indicate the service name or service port, and (optionally) the service protocol. The formatting of the string is illustrated as FTP or TCP or 21/TCP or just FTP. The string is not case sensitive. The slash mark, if present, separates the protocol identifier from the preceding part of the string. The Ws2_32.dll will specify LUP_RETURN_BLOB and the namespace provider will place a SERVENT structure in the blob (using offsets instead of pointers as described above). Namespace providers should honor these other LUP_RETURN_* flags as well.

Flag Description
LUP_RETURN_NAME Returns the s_name member from SERVENT structure in lpszServiceInstanceName.
LUP_RETURN_TYPE Returns canonical GUID in lpServiceClassId It is understood that a service identified as FTP or 21 may be on another port according to locally established conventions. The s_port parameter of the SERVENT structure should indicate where the service can be contacted in the local environment. The canonical GUID returned when LUP_RETURN_TYPE is set should be one of the predefined GUIDs from Svcs.h that corresponds to the port number indicated in the SERVENT structure.

 

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

Protocol-Independent Name Resolution

Registration and Name Resolution