Group: Windows Sockets 2 (Winsock) - Library: ws2_32
Winsock: how to retrieve a service information corresponding to a port
struct servent FAR * getservbyport(
int port,
const char FAR *proto
);
DECLARE INTEGER getservbyport IN ws2_32;
INTEGER port,;
STRING proto
port [in] Port for a service, in network byte order.
proto [in] Optional pointer to a protocol name.
If no error occurs, getservbyport returns a pointer to the servent structure. Otherwise, it returns a NULL pointer and a specific error number can be retrieved by calling WSAGetLastError.