NetSock_OptGet
Get the specified socket option from the sock_id
socket.
Files
net_sock.h/net_sock.c
Prototype
NET_SOCK_RTN_CODE_ID NetSock_OptGet(NET_SOCK_ID sock_id, NET_SOCK_PROTOCOL level, NET_SOCK_OPT_NAME opt_name, void *p_opt_val, NET_SOCK_OPT_LEN *p_opt_len, NET_ERR *p_err);
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 get the value.
p_opt_val
Pointer to a socket option value buffer.
p_opt_len
Pointer to variable a socket option value buffer length.
p_err
Pointer to variable that will receive the return error code from this function:
NET_SOCK_ERR_NONE
NET_SOCK_ERR_INVALID_OPT
NET_SOCK_ERR_INVALID_ARG
NET_SOCK_ERR_INVALID_OPT_LEN
NET_CONN_ERR_INVALID_OPT_GET
NET_CONN_ERR_INVALID_OPT_LEVEL
Returned Value
NET_SOCK_BSD_ERR_NONE/0
, if successful; NET_SOCK_BSD_ERR_OPT_GET/-1
, otherwise.
Required Configuration
None.
Notes / Warnings
The supported options are:
- Protocol level
NET_SOCK_PROTOCOL_SO
:NET_SOCK_OPT_SOCK_TYPE
NET_SOCK_OPT_SOCK_KEEP_ALIVE
NET_SOCK_OPT_SOCK_ACCEPT_CONN
NET_SOCK_OPT_SOCK_TX_BUF_SIZE / NET_SOCK_OPT_SOCK_RX_BUF_SIZE
NET_SOCK_OPT_SOCK_TX_TIMEOUT / NET_SOCK_OPT_SOCK_RX_TIMEOUT
- Protocol level
NET_SOCK_PROTOCOL_IP
:NET_SOCK_OPT_IP_TOS
NET_SOCK_OPT_IP_TTL
NET_SOCK_OPT_IP_RX_IF
- Protocol level
NET_SOCK_PROTOCOL_TCP
:NET_SOCK_OPT_TCP_NO_DELAY
NET_SOCK_OPT_TCP_KEEP_CNT
NET_SOCK_OPT_TCP_KEEP_IDLE
NET_SOCK_OPT_TCP_KEEP_INTVL