public function connect($host, $port, $secure = true)
    {
        $this->socket->setBlocking(false);

        if (!$this->socket->connect($host, $port, $secure)) {
            throw new Exception\ConnectionFailedException(
                sprintf(
                    '%s failed to %s:%d with error %s (%d).',
                    $secure ? 'Secure connection' : 'Connection',
                    $host,
                    $port,
                    $this->socket->connectionError(),
                    $this->socket->connectionErrorNo()
                )
            );
        }
    }
public function connect($host, $port, $secure = true)
    {
        $this->socket->setBlocking(false);

        if (!$this->socket->connect($host, $port, $secure)) {
            throw new Exception\ConnectionFailedException(
                sprintf(
                    '%s failed to %s:%d with error %s (%d).',
                    $secure ? 'Secure connection' : 'Connection',
                    $host,
                    $port,
                    $this->socket->connectionError(),
                    $this->socket->connectionErrorNo()
                )
            );
        }
    }
public function connect ( $ host , $ port , $ secure = true ) { $ this -> socket -> setBlocking ( false ) ; if ( ! $ this -> socket -> connect ( $ host , $ port , $ secure ) ) { throw new Exception \ ConnectionFailedException ( sprintf ( '%s failed to %s:%d with error %s (%d).' , $ secure ? 'Secure connection' : 'Connection' , $ host , $ port , $ this -> socket -> connectionError ( ) , $ this -> socket -> connectionErrorNo ( ) ) ) ; } }
Set up a connection to the server.

@param string  $host
@param integer $port
@param boolean $secure

@return void
Set up a connection to the server .