COHERENT manpages
This page displays the COHERENT manpage for listen() [Listen for a connection on a socket].
List of available manpages
Index
listen() -- Sockets Function (libsocket) Listen for a connection on a socket #include <sys/socket.h> int listen(socket, backlog) int socket, int backlog; Function listen() ``listens'' for a connection on socket. It also signals the system your process's willingness to accept a connection on that socket. This function applies only to sockets of type SOCK_STREAM or SOCK_SEQPACKET. socket is a file descriptor that identifies the socket in question. It must have been returned by a call to socket(). backlog defines the maximum length to which the queue of pending connections may grow. As of this writing, backlog is limited to a maximum of five. If a connection request arrives with the queue full, the client may receive an error with an indication of ECONNREFUSED; or if the underlying protocol supports retransmission, the request may be ignored so that retries may succeed. If all goes well, listen() returns zero. If an error occurs, it returns -1 and sets errno to an appropriate value. The following lists the errors that can occur, by the value to which listen() sets errno: EBADF socket is not a valid descriptor. ENOTSOCK socket does not identify a socket. EOPNOTSUPP socket is not of a type that supports listen(). Example For an example of this function, see the Lexicon entry for libsocket. See Also accept(), connect(), libsocket, socket()