Description
Get service information corresponding to a port and protocol.
#include <winsock.h>
struct servent FAR * PASCAL FAR getservbyport ( int port, const char FAR * proto);
port
Remarks
getservbyport() returns a pointer a servent structure as described above for getservbyname(). The pointer which is returned points to a structure which is allocated by the Windows Sockets implementation. The application must never attempt to modify this structure or to free any of its components. Furthermore, only one copy of this structure is allocated per thread, and so the application should copy any information which it needs before issuing any other Windows Sockets API calls.
Return Value
If no error occurs, getservbyport() returns a pointer to the servent structure described above. Otherwise it returns a NULL pointer and a specific error number may be retrieved by calling WSAGetLastError()
Error Codes
WSANOTINITIALISED
See Also
WSAAsyncGetServByPort(), getservbyname()