(PHP 4 >= 4.0.2)

listen -- Listens for a connection on a socket


int listen (int socket, int backlog)

After the socket socket has been created using socket() and bound to a name with bind(), it may be told to listen for incoming connections on socket. A maximum of backlog incoming connections will be queued for processing.

listen() is applicable only to sockets with type SOCK_STREAM or SOCK_SEQPACKET.

Returns zero on success, or a negative error code on failure. This code may be passed to strerror() to get a textual explanation of the error.

See also accept_connect(), bind(), connect(), socket(), socket_get_status(), and strerror().