public function readLine()
    {
        if (!$this->isConnected()) {
            throw new Rediska_Connection_Exception("Can't read without connection to Redis server. Do connect or write first.");
        }

        $reply = @fgets($this->_socket);
        
        if ($reply === false || $reply === '') {
            $metaData = stream_get_meta_data($this->_socket);
            if ($metaData['timed_out']) {
                throw new Rediska_Connection_TimeoutException("Connection read timed out.");
            }

            if ($this->_options['blockingMode'] && !$metaData['eof']) {
                $this->disconnect();
                throw new Rediska_Connection_Exception("Can't read from socket.");
            }

            $reply = null;
        } else {
            $reply = trim($reply);
        }

        return $reply;
    }