PHP Manual
Prev |  | Next

# socket_listen

(PHP 4 >= 4.1.0)

socket_listen -- Listens for a connection on a socket

## Description

``int socket_listen` (resource socket, int backlog)`

Warning
This function is EXPERIMENTAL. The behaviour of this function, the name of this function, and anything else documented about this function may 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_create() and bound to a name with socket_bind(), it may be told to listen for incoming connections on `socket`. A maximum of `backlog` incoming connections will be queued for processing.

socket_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 socket_strerror() to get a textual explanation of the error.

See also socket_accept(), socket_bind(), socket_connect(), socket_create(), socket_get_status(), and socket_strerror().

Prev | Home | Next
socket_connect | Up | socket_read