public function connect($server = 'localhost', $port = 9998)
    {
        $addr = "tcp://$server:$port";
        $this->socket = stream_socket_client($addr, $errc, $errs, STREAM_CLIENT_CONNECT);
        if (!$this->socket) {
            throw new IOException("Connection to $server:$port failed");
        }
    }