stream_socket_server

Supported Versions: PHP 5, PHP 7, PHP 8
Create an Internet or Unix domain server socket
<?php stream_socket_server(    string $address,    int &$error_code = null,    string &$error_message = null,    int $flags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN,    ?resource $context = null): resource|false
<?php             );

        }



        $this->master = @\stream_socket_server(

            $uri,

            $errno,

            $errstr,

            \STREAM_SERVER_BIND | \STREAM_SERVER_LISTEN,

            \stream_context_create(array('socket' => $context + array('backlog' => 511)))

        );

        if (false === $this->master) {

            if ($errno === 0) {
<?php             );

        }



        $this->master = @\stream_socket_server(

            $path,

            $errno,

            $errstr,

            \STREAM_SERVER_BIND | \STREAM_SERVER_LISTEN,

            \stream_context_create(array('socket' => $context))

        );

        if (false === $this->master) {
<?php         }



        $fd = self::getNextFreeFd();

        $socket = stream_socket_server('127.0.0.1:0');

        assert($socket !== false);



        $loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock();
<?php             $this->markTestSkipped('Not supported on your platform');

        }



        $socket = stream_socket_server('tcp://127.0.0.1:0');



        $fd = self::getNextFreeFd();

        $client = stream_socket_client('tcp://' . stream_socket_get_name($socket, false));
<?php         }



        $fd = self::getNextFreeFd();

        $socket = stream_socket_server('127.0.0.1:0');



        $loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock();
<?php         }



        $fd = self::getNextFreeFd();

        $socket = stream_socket_server('127.0.0.1:0');



        $loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock();
<?php         }



        $fd = self::getNextFreeFd();

        $socket = @stream_socket_server('[::1]:0');

        if ($socket === false) {

            $this->markTestSkipped('Listening on IPv6 not supported');

        }
<?php         }



        $fd = self::getNextFreeFd();

        $socket = @stream_socket_server($this->getRandomSocketUri());

        if ($socket === false) {

            $this->markTestSkipped('Listening on Unix domain socket (UDS) not supported');

        }
<?php         }



        $fd = self::getNextFreeFd();

        $socket = stream_socket_server('127.0.0.1:0');

        assert($socket !== false);



        $loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock();
<?php         }



        $fd = self::getNextFreeFd();

        $socket = stream_socket_server('127.0.0.1:0');

        assert($socket !== false);



        $loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock();
<?php         }



        $fd = self::getNextFreeFd();

        $socket = stream_socket_server('127.0.0.1:0');

        assert($socket !== false);



        $loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock();
<?php         }



        $fd = self::getNextFreeFd();

        $socket = stream_socket_server('127.0.0.1:0');

        assert($socket !== false);



        $loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock();
<?php         }



        $fd = self::getNextFreeFd();

        $socket = stream_socket_server('127.0.0.1:0');

        assert($socket !== false);



        $loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock();
<?php         }



        $fd = self::getNextFreeFd();

        $socket = stream_socket_server('127.0.0.1:0');

        assert($socket !== false);



        $loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock();
<?php         }



        $fd = self::getNextFreeFd();

        $socket = stream_socket_server('127.0.0.1:0');

        assert($socket !== false);



        $client = stream_socket_client('tcp://' . stream_socket_get_name($socket, false));