protected function recvStr($read = true)
    {
        $str = @fgets($this->socket);
        if (!$str) {
            $this->disconnect();
            throw new IOException('Cannot read from socket');
        }
        return substr($str, 0, -1);
    }