listen(2)listen(2)Namelisten - listen for connections on a socket
Syntax
listen(s, backlog)
int s, backlog;
Description
To accept connections, a socket is first created with a call, a backlog
for incoming connections is specified with and then the connections are
accepted with the call. The call is needed only for sockets of type
SOCK_STREAM or SOCK_SEQPACKET.
The backlog parameter defines the maximum length the queue of pending
connections may grow to. If a connection request arrives with the
queue full, the client receives an error with an indication of ECONNREā
FUSED.
Restrictions
The backlog is currently limited to 8.
Return Values
A 0 return value indicates success. A -1 indicates an error.
Diagnostics
The call fails under the following conditions:
[EBADF] The argument s is not a valid descriptor.
[ENOTSOCK] The argument s is not a socket.
[EOPNOTSUPP] The socket is not of a type that supports the operation
See Alsoaccept(2), connect(2), socket(2)listen(2)