stream_socket_pair

Supported Versions: PHP 5 >= 5.1.0, PHP 7, PHP 8
Creates a pair of connected, indistinguishable socket streams
<?php stream_socket_pair(int $domain, int $type, int $protocol): array|false
<?php     public function createSocketPair()

    {

        $domain = (DIRECTORY_SEPARATOR === '\\') ? STREAM_PF_INET : STREAM_PF_UNIX;

        $sockets = stream_socket_pair($domain, STREAM_SOCK_STREAM, STREAM_IPPROTO_IP);



        foreach ($sockets as $socket) {

            if (function_exists('stream_set_read_buffer')) {