public function openSocket(int $timeout = 5, callable $openWith = null): Stream
    {
        $socket = $this->createSocket();
        if (null !== $openWith) {
            $socket->openWith($openWith);
        }

        return $socket->connect()->setTimeout($timeout);
    }
public function openSocket(int $timeout = 5, callable $openWith = null): Stream
    {
        $socket = $this->createSocket();
        if (null !== $openWith) {
            $socket->openWith($openWith);
        }

        return $socket->connect()->setTimeout($timeout);
    }
public function openSocket ( int $ timeout = 5 , callable $ openWith = null ) : Stream { $ socket = $ this -> createSocket ( ) ; if ( null !== $ openWith ) { $ socket -> openWith ( $ openWith ) ; } return $ socket -> connect ( ) -> setTimeout ( $ timeout ) ; }
opens socket to this uri

@param   int       $timeout  connection timeout
@param   callable  $openWith  optional  open port with this function
@return  \stubbles\peer\Stream
@since   2.0.0
opens socket to this uri