Beispiel #1
0
	def test_connection(self):
		used_port = []
		try:
			new_server = Server.GnutellaFactory()
			for i in range(0, 2):
				used_port.append(reactor.listenTCP(8000 + i, new_server))
			for i in range(0, 2):
				reactor.connectTCP("127.0.0.1", 8000 + i, Sender.GnutellaFactory(True))
			reactor.run()
		except Exception as e:
			print(e)
Beispiel #2
0
def start_gnutella(port, ip):
    server = Sender.GnutellaFactory()
    reactor.listenTCP(8000 + port, server)
    gnutella_connect(port, ip)
    reactor.callInThread(Sender.get_user_input)
    reactor.run()
Beispiel #3
0
def gnutella_connect(port, ip):
    for i in range(0, 100):
        if i != port:
            reactor.connectTCP("127.0.0.1", 8000 + i,
                               Sender.GnutellaFactory(True))