from twisted.application import service, internet from twisted.python.log import ILogObserver import sys, os sys.path.append(os.path.dirname(__file__)) from kademlia.network import Server from kademlia import log application = service.Application("kademlia") application.setComponent(ILogObserver, log.FileLogObserver(sys.stdout, log.INFO).emit) kserver = Server() server = internet.UDPServer(1234, kserver.protocol) server.setServiceParent(application)