guacamole/client.py
def receive(self):
        """
        Receive instructions from Guacamole guacd server.
        """
        start = 0

        while True:
            idx = self._buffer.find(INST_TERM.encode(), start)
            if idx != -1:
                # instruction was fully received!
                line = self._buffer[:idx + 1].decode()
                self._buffer = self._buffer[idx + 1:]
                self.logger.debug('Received instruction: %s' % line)
                return line
            else:
                start = len(self._buffer)
                # we are still waiting for instruction termination
                buf = self.client.recv(BUF_LEN)
                if not buf:
                    # No data recieved, connection lost?!
                    self.close()
                    self.logger.debug(
                        'Failed to receive instruction. Closing.')
                    return None
                self._buffer.extend(buf)
def receive(self):
        start = 0

        while True:
            idx = self._buffer.find(INST_TERM.encode(), start)
            if idx != -1:
                # instruction was fully received!
                line = self._buffer[:idx + 1].decode()
                self._buffer = self._buffer[idx + 1:]
                self.logger.debug('Received instruction: %s' % line)
                return line
            else:
                start = len(self._buffer)
                # we are still waiting for instruction termination
                buf = self.client.recv(BUF_LEN)
                if not buf:
                    # No data recieved, connection lost?!
                    self.close()
                    self.logger.debug(
                        'Failed to receive instruction. Closing.')
                    return None
                self._buffer.extend(buf)
def receive ( self ) : start = 0 while True : idx = self . _buffer . find ( INST_TERM . encode ( ) , start ) if idx != - 1 : # instruction was fully received! line = self . _buffer [ : idx + 1 ] . decode ( ) self . _buffer = self . _buffer [ idx + 1 : ] self . logger . debug ( 'Received instruction: %s' % line ) return line else : start = len ( self . _buffer ) # we are still waiting for instruction termination buf = self . client . recv ( BUF_LEN ) if not buf : # No data recieved, connection lost?! self . close ( ) self . logger . debug ( 'Failed to receive instruction. Closing.' ) return None self . _buffer . extend ( buf )
Receive instructions from Guacamole guacd server.
Receive instructions from Guacamole guacd server .