protected function create()
    {

        // Create the remote address
        $remote_addr = sprintf("%s://%s:%d", $this->transport, $this->ip, $this->port);

        // Create context
        $context = stream_context_create([
            'socket' => [
                'bindto' => '0:0', // Bind to any available IP and OS decided port
            ],
        ]);

        // Define these first
        $errno = null;
        $errstr = null;

        // Create the socket
        if (($this->socket =
                @stream_socket_client($remote_addr, $errno, $errstr, $this->timeout, STREAM_CLIENT_CONNECT, $context))
            !== false
        ) {
            // Set the read timeout on the streams
            stream_set_timeout($this->socket, $this->timeout);

            // Set blocking mode
            stream_set_blocking($this->socket, $this->blocking);
        } else {
            // Reset socket
            $this->socket = null;

            // Something bad happened, throw query exception
            throw new Exception(
                __METHOD__ . " - Error creating socket to server {$this->ip}:{$this->port}. Error: " . $errstr,
                $errno
            );
        }
    }
protected function create()
    {

        // Create the remote address
        $remote_addr = sprintf("%s://%s:%d", $this->transport, $this->ip, $this->port);

        // Create context
        $context = stream_context_create([
            'socket' => [
                'bindto' => '0:0', // Bind to any available IP and OS decided port
            ],
        ]);

        // Define these first
        $errno = null;
        $errstr = null;

        // Create the socket
        if (($this->socket =
                @stream_socket_client($remote_addr, $errno, $errstr, $this->timeout, STREAM_CLIENT_CONNECT, $context))
            !== false
        ) {
            // Set the read timeout on the streams
            stream_set_timeout($this->socket, $this->timeout);

            // Set blocking mode
            stream_set_blocking($this->socket, $this->blocking);
        } else {
            // Reset socket
            $this->socket = null;

            // Something bad happened, throw query exception
            throw new Exception(
                __METHOD__ . " - Error creating socket to server {$this->ip}:{$this->port}. Error: " . $errstr,
                $errno
            );
        }
    }
protected function create ( ) { // Create the remote address $ remote_addr = sprintf ( "%s://%s:%d" , $ this -> transport , $ this -> ip , $ this -> port ) ; // Create context $ context = stream_context_create ( [ 'socket' => [ 'bindto' => '0:0' , // Bind to any available IP and OS decided port ] , ] ) ; // Define these first $ errno = null ; $ errstr = null ; // Create the socket if ( ( $ this -> socket = @ stream_socket_client ( $ remote_addr , $ errno , $ errstr , $ this -> timeout , STREAM_CLIENT_CONNECT , $ context ) ) !== false ) { // Set the read timeout on the streams stream_set_timeout ( $ this -> socket , $ this -> timeout ) ; // Set blocking mode stream_set_blocking ( $ this -> socket , $ this -> blocking ) ; } else { // Reset socket $ this -> socket = null ; // Something bad happened, throw query exception throw new Exception ( __METHOD__ . " - Error creating socket to server {$this->ip}:{$this->port}. Error: " . $ errstr , $ errno ) ; } }
Create a new socket for this query

@throws \GameQ\Exception\Query
Create a new socket for this query