Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

Set the specified socket option to the sock_id socket.

Files

net_sock.h/net_sock.c

Prototype

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 set the socket option.

opt_name

Name of the option to set.

p_opt_val

Pointer to the value to set the socket option.

opt_len

Option length.

p_err

Pointer to variable that will receive the return error code from this function:

NET_SOCK_ERR_NONE
NET_SOCK_ERR_INVALID_DATA_SIZE
NET_SOCK_ERR_NULL_PTR
NET_SOCK_ERR_INVALID_OPT

Returned Value

NET_SOCK_BSD_ERR_NONE/0, if successful;

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
  • No labels