Group: Windows Sockets 2 (Winsock) - Library: ws2_32
The getservbyname function retrieves service information corresponding to a service name and protocol.
Winsock: how to retrieve a service information corresponding to a service name
struct servent FAR * getservbyname(
const char FAR *name,
const char FAR *proto
);
DECLARE INTEGER getservbyname IN ws2_32;
STRING name,;
STRING proto
name [in] Pointer to a null-terminated service name.
proto [in] Optional pointer to a null-terminated protocol name.
If no error occurs, getservbyname returns a pointer to the servent structure. Otherwise, it returns a NULL pointer and a specific error number can be retrieved by calling WSAGetLastError.