listen(2) — System Calls
NAME
listen − Listens for socket connections and limits the backlog of incoming connections
SYNOPSIS
int listen (
int socket,
int backlog );
PARAMETERS
socketSpecifies the unique name for the socket.
backlogSpecifies the maximum number of outstanding connection requests.
DESCRIPTION
The listen() function identifies the socket that receives the connections, marks the socket as accepting connections, and limits the number (backlog) of outstanding connection requests in the system queue.
The maximum queue length (backlog) that the listen() function can specify is eight. The maximum queue length is indicated by the SOMAXCONN value in the sys/socket.h header file.
RETURN VALUES
Upon successful completion, the listen() function returns a value of 0 (zero). Otherwise, a value of -1 is returned and errno is set to indicate the error.
ERRORS
If the listen() function fails, errno may be set to one of the following values:
[EBADF]The socket parameter is not valid.
[ENOTSOCK]
The socket parameter refers to a file, not a socket.
[EOPNOTSUPP]
The referenced socket is not a type that supports the listen() function.
RELATED INFORMATION
Functions: accept(2), connect(2), socket(2)