socket_create_listen
Function • Params changed in PHP 8.4
Opens a socket on port to accept connections.
socket_create_listen Function synopsis
socket_create_listen(int $port, int $backlog = SOMAXCONN): Socket|false
Parameters
$port
Typeint
The port on which to listen on all interfaces.
$backlog
OptionalTypeintDefault valueSOMAXCONN
The $backlog parameter defines the maximum length
the queue of pending connections may grow to.
SOMAXCONN may be passed as
$backlog parameter, see
socket_listen for more information.
Return value
TypeSocket|false
socket_create_listen returns a new Socket instance
on success or false on error. The error code can be retrieved with
socket_last_error. This code may be passed to
socket_strerror to get a textual explanation of the
error.
Changes to the socket_create_listen Function
PHP 8.4
- Parameter default value changed for position #2 (
$backlog):128toSOMAXCONN
- socket_create_listen(int $port, int $backlog = 128): Socket|false
+ socket_create_listen(int $port, int $backlog = SOMAXCONN): Socket|false PHP 8.0
- Return type added:
Socket|false - Parameter type added for parameter #1 (
$port):int - Parameter type added for parameter #2 (
$backlog):int - Parameter default value added for position #2 (
$backlog):128
- socket_create_listen($port, $backlog)
+ socket_create_listen(int $port, int $backlog = 128): Socket|false socket_create_listen Function Availability
socket_create_listen Function Availability| PHP Version | Availability |
|---|---|
| PHP 8.6Upcoming Release | Yes |
| PHP 8.5Supported (Latest) | Yes |
| PHP 8.4Supported | Yes |
| PHP 8.3Security-Fixes Only | Yes |
| PHP 8.2Security-Fixes Only | Yes |
| PHP 8.1Unsupported | Yes |
| PHP 8.0Unsupported | Yes |
| PHP 7.4Unsupported | Yes |
| PHP 7.3Unsupported | Yes |
| PHP 7.2Unsupported | Yes |
| PHP 7.1Unsupported | Yes |
| PHP 7.0Unsupported | Yes |
| PHP 5.6Unsupported | Yes |
| PHP 5.5Unsupported | Yes |
| PHP 5.4Unsupported | Yes |
| PHP 5.3Unsupported | Yes |