[Twisted-Python] How to start a server when ready
![](https://secure.gravatar.com/avatar/0ec172e84026b3a3b9ebb5aed3a9a7b9.jpg?s=120&d=mm&r=g)
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,
![](https://secure.gravatar.com/avatar/d7875f8cfd8ba9262bfff2bf6f6f9b35.jpg?s=120&d=mm&r=g)
Call from twisted.internet import reactor; reactor.listenTCP(port, factory) once your code wants to start listening. -- Itamar Shtull-Trauring http://itamarst.org
![](https://secure.gravatar.com/avatar/d7875f8cfd8ba9262bfff2bf6f6f9b35.jpg?s=120&d=mm&r=g)
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