stream_socket_client

Supported Versions: PHP 5, PHP 7, PHP 8
Open Internet or Unix domain socket connection
<?php stream_socket_client(    string $address,    int &$error_code = null,    string &$error_message = null,    ?float $timeout = null,    int $flags = STREAM_CLIENT_CONNECT,    ?resource $context = null): resource|false
<?php     {

        set_error_handler([self::class, 'nullErrorHandler']);

        try {

            return stream_socket_client($this->host, $errno, $errstr, 3, \STREAM_CLIENT_CONNECT | \STREAM_CLIENT_ASYNC_CONNECT);

        } finally {

            restore_error_handler();

        }