Skip to content

Latest commit

 

History

History
67 lines (47 loc) · 1.38 KB

File metadata and controls

67 lines (47 loc) · 1.38 KB

Home

Function name : getsockopt

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


The getsockopt function retrieves a socket option.


Code examples:

Winsock: reading and setting socket options

Declaration:

int getsockopt(
  SOCKET s,
  int level,
  int optname,
  char FAR *optval,
  int FAR *optlen
);  

FoxPro declaration:

DECLARE INTEGER getsockopt IN ws2_32;
	INTEGER   s,;
	INTEGER   level,;
	INTEGER   optname,;
	STRING  @ optval,;
	INTEGER @ optlen  

Parameters:

s [in] Descriptor identifying a socket.

level [in] Level at which the option is defined; the supported levels include SOL_SOCKET and IPPROTO_TCP.

optname [in] Socket option for which the value is to be retrieved.

optval [out] Pointer to the buffer in which the value for the requested option is to be returned.

optlen [in, out] Pointer to the size of the optval buffer.


Return value:

If no error occurs, getsockopt returns zero. Otherwise, a value of SOCKET_ERROR is returned, and a specific error code can be retrieved by calling WSAGetLastError.


Comments:

See also setsockopt function.