getsockopt TCP UDP
Get a specific option value on a specific TCP socket. See function NetSock_OptGet for more information.
Files
net_bsd.h/net_bsd.c
Prototype
int getsockopt(int sock_id, int level, int opt_name, void *p_opt_val, sock_len_t *p_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.
p_opt_val
Pointer to the socket option value to set.
p_opt_len
Pointer to the socket option value to get.
Returned Value
0
, if successful;
-1
, otherwise.
Required Configuration
None.
Notes / Warnings
The supported options are:
- Protocol level
SOL_SOCKET
:SO_TYPE
SO_KEEPALIVE
SO_ACCEPTCONN
SO_SNDBUF / SO_RCVBUF
SO_SNDTIMEO / SO_RCVTIMEO
- Protocol level
IPPROTO_IP
:IP_TOS
IP_TTL
IP_RECVIF
- Protocol level
IPPROTO_TCP
:TCP_NODELAY
TCP_KEEPCNT
TCP_KEEPIDLE
TCP_INTVL