listen

(4.0.2 - 4.0.6 only)

listen -- Listens for a connection on a socket

Description

int listen (resource socket, int backlog)

Warning

This function is EXPERIMENTAL. That means, that the behaviour of this function, this function name, in concreto ANYTHING documented here can change in a future release of PHP WITHOUT NOTICE. Be warned, and use this function at your own risk.

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().