LISTEN(2)
NAME
listen − listen for connections on a socket
USAGE
listen(s, backlog)
int s, backlog;
DESCRIPTION
To accept connections, a socket is created with socket(2), a backlog for incoming connections is specified with listen(2), and the connections are accepted with accept(2).
The backlog parameter defines the maximum length of the queue of pending connections. If a connection request arrives and the queue is full, the client will receive the error ECONNREFUSED.
NOTES
The maximum backlog is five.
The listen call applies only to sockets of the type SOCK_STREAM or SOCK_PKTSTREAM.
RETURN VALUE
A zero return value indicates success; −1 indicates an error.
ERRORS
The call fails if:
[EBADF] The argument s is not a valid descriptor.
[ENOTSOCK] The argument s is not a socket.
[EOPNOTSUPP] Listen does not support this type of socket.