Skip to content

Latest commit

 

History

History
71 lines (47 loc) · 1.3 KB

setsockopt.md

File metadata and controls

71 lines (47 loc) · 1.3 KB

Home

Function name : setsockopt

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


The setsockopt function sets a socket option.


Code examples:

Winsock: reading and setting socket options

Declaration:

int setsockopt(
  SOCKET s,
  int level,
  int optname,
  const char* optval,
  int optlen
);
  

FoxPro declaration:

DECLARE INTEGER setsockopt 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. Example: SOL_SOCKET.

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

optval [in] Pointer to the buffer in which the value for the requested option is specified.

optlen [in] Size of the optval buffer, in bytes.


Return value:

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


Comments:

See also getsockopt function.