listen(2)
NAME
listen − listen for connections on a socket
SYNTAX
int listen(s, backlog)
int s, backlog;
DESCRIPTION
To accept connections, a socket is first created with the socket call, a backlog for incoming connections then is specified with the listen call, and the connections finally are accepted with the accept call. The listen system call applies only to sockets of type SOCK_STREAM or SOCK_PKTSTREAM.
The specified backlog defines the maximum length the queue of pending connections may grow to. If a connection request arrives with the queue full the client will receive an error with an indication of ECONNREFUSED.
RESTRICTIONS
The backlog argument is currently limited to 5.
RETURN VALUE
If unsuccessful, returns a −1, and the global variable errno indicates the error code.
DIAGNOSTICS
The listen call will fail if:
[EBADF] The specified s is not a valid descriptor.
[ENOTSOCK] The specified s is not a socket.
[EOPNOTSUPP] The socket is not of a type that supports the listen operation.