Skip to content

Latest commit

 

History

History
46 lines (32 loc) · 1.05 KB

getservbyport.md

File metadata and controls

46 lines (32 loc) · 1.05 KB

Home

Function name : getservbyport

Group: Windows Sockets 2 (Winsock) - Library: ws2_32


The getservbyport function retrieves service information corresponding to a port and protocol.


Code examples:

Winsock: how to retrieve a service information corresponding to a port

Declaration:

struct servent FAR * getservbyport(
  int port,
  const char FAR *proto
);  

FoxPro declaration:

DECLARE INTEGER getservbyport IN ws2_32;
	INTEGER port,;
	STRING  proto  

Parameters:

port [in] Port for a service, in network byte order.

proto [in] Optional pointer to a protocol name.


Return value:

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.