Versions Compared

Key

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

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


 
Code Block

NET_SOCK_RTN_CODE NetSock_Listen(NET_SOCK_ID      sock_id,
                                 NET_SOCK_Q_SIZE  sock_q_size,
                                 NET_ERR         *p_err);

int listen(int sock_id,
           int sock_q_size);


Arguments

sock_id

This is the socket ID returned by NetSock_Open()/socket() when the socket was created.

...

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.