public function gets($size)
    {
        $this->_checkStream();
        $data = @fgets($this->_stream, $size);
        if ($data === false) {
            throw new Client\Exception('Error reading data from socket');
        }
        return $data;
    }