listen(2dn)
NAME
listen − listen for pending connect requests
SYNTAX
listen (s,backlog)
int s,backlog;
ARGUMENTS
Input Arguments
s Specifies a descriptor for a socket that has been returned by the socket call and bound to a name by the bind call.
backlog Defines the maximum length for the queue of pending connect requests for a particular socket. If a connect request arrives when the queue is full, the connection will be rejected.
DESCRIPTION
The listen call declares a socket as being available to receive connect requests and listens for incoming connections. The listen call must be issued before the server program accepts an incoming connection request.
RETURN VALUE
If the call succeeds, a value of 0 is returned. If an error occurs, a value of −1 is returned. When an error condition exists, the external variable errno contains error detail.
DIAGNOSTICS
[EBADF] The s argument is not a valid descriptor.
[EADDRINUSE] The name bound to the socket is already being used for a listen socket.