listen()
Bind a name to a socket
#include 'sys/socket.h'
int listen (int sockfd, int backlog );

DESCRIPTION :

listen() marks the socket referred to by sockfd as a passive socket, that is, as a socket that will be used to accept incoming connec‐ tion requests using accept(2).

The sockfd argument is a file descriptor that refers to a socket of type SOCK_STREAM or SOCK_SEQPACKET.

The backlog argument defines the maximum length to which the queue of pending connections for sockfd may grow. If a connection request arrives when the queue is full, the client may receive an error with an indication of ECONNREFUSED or, if the underlying protocol sup‐ ports retransmission, the request may be ignored so that a later reattempt at connection succeeds.

Return Value

On success, zero is returned. On error, -1 is returned, and errno is set appropriately.