def _send(self, sync, query): if sync: message = array.array('b', [0,1,0,0]) # 1 for synchronous requests else: message = array.array('b', [0,0,0,0]) # 1 for synchronous requests message.fromstring(_parser.write_integer(0)) # reserve space for message length message = _parser.write(query,message) message[4:8] = _parser.write_integer(len(message)) self.last_outgoing=message self.sock.send(message)
def _write_self(self,message): message.fromstring(parser.write_byte(0)+parser.write_integer(len(self))) for el in self: if self.type.code != 0: message.fromstring(self.type.write_data(el)) else: message.fromstring(parser.write(el)) return message
def _write_self(self, message): message.fromstring( parser.write_byte(0) + parser.write_integer(len(self))) for el in self: if self.type.code != 0: message.fromstring(self.type.write_data(el)) else: message.fromstring(parser.write(el)) return message