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')
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)
def connect(self): """Establishes connection to the remote end""" Client.connect(self) self.socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, True)
def __init__(self, host, port): Client.__init__(self, host, port) Transport.__init__(self)