stream_socket_accept
Function • Params changed in PHP 8.0
Accept a connection on a socket created by stream_socket_server.
stream_socket_accept Function synopsis
stream_socket_accept(
$socket,
?float $timeout = null,
&$peer_name = null
)
Parameters
$socket
The server socket to accept a connection from.
$timeout
OptionalType?floatDefault valuenull
Override the default socket accept timeout. Time should be given in
seconds. By default, default_socket_timeout is used.
$peer_name
Passed by reference, OptionalDefault valuenull
Will be set to the name (address) of the client which connected, if included and available from the selected transport.
Note that the parameter
$peer_nameis passed by reference, and contains additional/updated context data that may be useful.
Changes to the stream_socket_accept Function
PHP 8.0
- Parameter name of parameter #1 changed:
$serverstreamto$socket - Parameter type added for parameter #2 (
$timeout):?float - Parameter default value added for position #2 (
$timeout):null - Parameter name of parameter #3 changed:
$peernameto$peer_name - Parameter default value added for position #3 (
$peer_name):null
stream_socket_accept(
- $serverstream,
+ $socket,
- $timeout,
+ ?float $timeout = null,
- &$peername
+ &$peer_name = null
) stream_socket_accept Function Availability
stream_socket_accept 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 |