Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

net_sock.h/net_sock.c

Prototype

Code Block
          NET_SOCK_RTN_CODE_ID NetSock_OptSet(NET_SOCK_ID        sock_id,
                                              NET_SOCK_PROTOCOL  level,
                                              NET_SOCK_OPT_NAME  opt_name,
                                              void              *p_opt_val,
                                              NET_SOCK_OPT_LEN   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.

...

NET_SOCK_BSD_ERR_OPT_SET/-1, otherwise.

Required Configuration

None.

Notes / Warnings

The supported options are:

  • Protocol level NET_SOCK_PROTOCOL_SO:
    • NET_SOCK_OPT_SOCK_KEEP_ALIVE
    • 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
  • 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

Info

This function must be called after either listen() (in the server case) or connect() (in the client case) have been called.