kademlia/server.tac

14 lines
456 B
Python
Raw Normal View History

2014-01-04 20:27:45 +01:00
from twisted.application import service, internet
2014-01-14 01:49:16 +01:00
from twisted.python.log import ILogObserver
2014-01-04 20:27:45 +01:00
import sys, os
sys.path.append(os.path.dirname(__file__))
from kademlia.network import Server
2014-01-14 01:49:16 +01:00
from kademlia import log
2014-01-04 20:27:45 +01:00
application = service.Application("kademlia")
2014-01-14 01:49:16 +01:00
application.setComponent(ILogObserver, log.FileLogObserver(sys.stdout, log.INFO).emit)
2014-01-04 20:27:45 +01:00
kserver = Server()
server = internet.UDPServer(1234, kserver.protocol)
server.setServiceParent(application)