コード例 #1
0
 def send_ADDR(self):
     _print(" [>] Telling " + self.remote_nodeid + " about my peers")
     # Shouldn't this be a list and not a dict?
     peers = self.factory.peers
     listeners = [(n, peers[n][0], peers[n][1], peers[n][2]) for n in peers]
     addr = messages.create_addr(self.nodeid, listeners)
     self.write(addr)
コード例 #2
0
ファイル: p2pClient.py プロジェクト: snegirevnews/udpPython
 def datagramReceived(self, data, addr):
     print("received %r from %s" % (data, addr))
     entry = (addr[0], addr[1])
     print(entry)
     print(data.decode())
     self.peers[data.decode()] = entry
     peers = self.peers
     listeners = [(n, peers[n][0], peers[n][1]) for n in peers]
     addres = messages.create_addr(self.nodeid, listeners)
     self.transport.write(addres.encode(), addr)
コード例 #3
0
 def send_ADDR(self):
     peers = self.factory.peers
     listeners = [(n, peers[n][0], peers[n][1], peers[n][2]) for n in peers]
     addr = messages.create_addr(self.nodeid, listeners)
     self.sendLine(addr)
     print("Telling " + self.remote_nodeid + " about my peers")