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 section C-13-1 “NetSockfunction NetSock_Accept() / accept() (TCP)”).
Files
net_sock.h/net_sock.c
net_bsd.h/net_bsd.c
...
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.
perr
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_INITNOT_INCOMPLETECOMPLETED
NET_OSERR_ERRFAULT_LOCK_ACQUIRE
Returned Value
NET_SOCK_BSD_ERR_NONE/0
, if successful;
NET_SOCK_BSD_ERR_LISTEN/-1
, otherwise.
Required Configuration
NetSock_Listen()
is available only if either NET_CFG_TRANSPORT_LAYER_SEL
is configured for TCP (see section D-12-1) and/or NET_UDP_CFG_APP_API_SEL
is configured for sockets (see section D-13-1).
In addition, listen()
is available only if NET_BSD_CFG_API_EN
is enabled (see section D-17-1Available only if NET_TCP_CFG_EN
is enabled (see section TCP Layer Configuration).
Notes / Warnings
None.