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     public function start(): void

    {

        if (!$this->socket = stream_socket_server($this->host, $errno, $errstr)) {

            throw new \RuntimeException(sprintf('Server start failed on "%s": ', $this->host).$errstr.' '.$errno);

        }

    }