def write_extend_message(self, metadata_message_id, payload): if DEBUG: print >> sys.stderr, self._address, 'MiniBitTorrent.write_extend_message()' payload = bencode(payload) self._socket.write(''.join((tobinary(2 + len(payload)), EXTEND, metadata_message_id, payload)))
def send_message(self, message): self.last_use = time() s = tobinary(len(message)) + message self.write(s)
def send_message(self, message): self.last_use = time() s = tobinary(len(message)) + message if DEBUG: print >> sys.stderr, 'dlbconn: Sending message', len(message) self.write(s)