def readlines(self, timeout=1):
        """
        read all lines that are available. abort after timeout
        when no more data arrives.
        """
        lines = []
        while 1:
            line = self.readline(timeout=timeout)
            if line:
                lines.append(line)
            if not line or line[-1:] != '\n':
                break
        return lines
read all lines that are available. abort after timeout
        when no more data arrives.