stream_socket_accept

Supported Versions: PHP 5, PHP 7, PHP 8
Accept a connection on a socket created by stream_socket_server()
<?php stream_socket_accept(resource $socket, ?float $timeout = null, string &$peer_name = null): resource|false
<?php Loop::addReadStream($server, function ($server) {

    $conn = stream_socket_accept($server);

    $data = "HTTP/1.1 200 OK\r\nContent-Length: 3\r\n\r\nHi\n";

    Loop::addWriteStream($conn, function ($conn) use (&$data) {

        $written = fwrite($conn, $data);