[Twisted-Python] How to start a server when ready
Hi, My program first connects to another server and get some data to initialises itself. When the initialisation finishes which could take few minutes, it then start listening on a port and waiting to server other clients. My question is, how do I delay the starting of my server until the program is ready? I am currently using some thing like this in my server.tac file, but this will star the server instantly. client = internet.TCPClient(otherHost, otherPort, clientFactory) client.setServiceParent(myService) server = internet.TCPServer(myPort, serverFactory) server.setServiceParent(myService) Thanks,
Call from twisted.internet import reactor; reactor.listenTCP(port, factory) once your code wants to start listening. -- Itamar Shtull-Trauring http://itamarst.org
participants (2)
-
Itamar Shtull-Trauring -
Minh Luu