/
setsockopt TCP UDP
setsockopt TCP UDP
Set a specific option on a specific TCP socket. See function NetSock_OptSet for more information.
Files
net_bsd.h/net_bsd.c
Prototype
int setsockopt (int sock_id, int level, int opt_name, void *p_opt_val, sock_len_t opt_len);
Arguments
sock_id
This is the socket ID returned by NetSock_Open()/socket()
when the socket was created or by NetSock_Accept()/accept()
when a connection was accepted.
level
Protocol level from which to retrieve the socket option.
opt_name
Socket option to set the value.
popt_val
Pointer to the socket option value to set.
opt_len
Option length.
Returned Value
0
, if successful;
-1
, otherwise.
Required Configuration
None.
Notes / Warnings
The supported options are:
- Protocol level
SOL_SOCKET
:SO_KEEPALIVE
SO_SNDBUF / SO_RCVBUF
SO_SNDTIMEO / SO_RCVTIMEO
- Protocol level
IPPROTO_IP
:IP_TOS
IP_TTL
- Protocol level
IPPROTO_TCP
:TCP_NODELAY
TCP_KEEPCNT
TCP_KEEPIDLE
TCP_INTVL
This function must be called after either listen() (in the server case) or connect() (in the client case) have been called.
, multiple selections available,
Related content
getsockopt TCP UDP
getsockopt TCP UDP
More like this
bind TCP UDP
bind TCP UDP
More like this
FD_SET TCP UDP
FD_SET TCP UDP
More like this
socket TCP UDP
socket TCP UDP
More like this
recv / recvfrom TCP UDP
recv / recvfrom TCP UDP
Read with this
NetSock_Listen
NetSock_Listen
More like this