示例#1
0
 def flush(self):
     """Flushes any accumuated outgoing messages"""
     if self.accumulator:
         LOGGER.debug('\ndispatching %s requests in one shot %(:,)d bytes',
                      self.accumulator.msgCount,
                      len(self.accumulator.buffer))
         Client.send(self, self.accumulator.buffer)
         self.accumulator.reset()
     else:
         raise Exception('failed to flush - buferring not enabled')
示例#2
0
    def send(self, msg):
        """
    Transmits a message using the underlying transport

    :param msg: Message to be sent

    """
        payload = encode(msg)
        if self.accumulator:
            self.accumulator.accumulate(payload)
        else:
            Client.send(self, payload)
示例#3
0
 def connect(self):
     """Establishes connection to the remote end"""
     Client.connect(self)
     self.socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, True)
示例#4
0
 def __init__(self, host, port):
     Client.__init__(self, host, port)
     Transport.__init__(self)