Set a socket to accept incoming connections. The socket must already be bound to a local address. If successful, incoming TCP connection requests addressed to the socket’s local address will be queued until accepted by the socket (see function NetSock_Accept()).
Files
net_sock.h/net_sock.c
net_bsd.h/net_bsd.c
Prototypes
Arguments
sock_id
This is the socket ID returned by NetSock_Open()/socket()
when the socket was created.
sock_q_size
Maximum number of new connections allowed to be waiting. In other words, this argument specifies the maximum queue length of pending connections while the listening socket is busy servicing the current request.
p_err
Pointer to variable that will receive the return error code from this function:
NET_SOCK_ERR_NONE
NET_SOCK_ERR_NOT_USED
NET_SOCK_ERR_CLOSED
NET_SOCK_ERR_INVALID_SOCK
NET_SOCK_ERR_INVALID_FAMILY
NET_SOCK_ERR_INVALID_PROTOCOL
NET_SOCK_ERR_INVALID_TYPE
NET_SOCK_ERR_INVALID_STATE
NET_SOCK_ERR_INVALID_OP
NET_SOCK_ERR_CONN_FAIL
NET_CONN_ERR_NOT_USED
NET_CONN_ERR_INVALID_CONN
NET_INIT_ERR_NOT_COMPLETED
NET_ERR_FAULT_LOCK_ACQUIRE
Returned Value
NET_SOCK_BSD_ERR_NONE/0
, if successful;
NET_SOCK_BSD_ERR_LISTEN/-1
, otherwise.
Required Configuration
Available only if NET_TCP_CFG_EN
is enabled (see section TCP Layer Configuration).
Notes / Warnings
None.