[Twisted-Python] Multiple clients
bszabolcs at gmail.com
Fri Jun 18 13:55:49 EDT 2010
On Friday 18 June 2010 20:25:50 Itamar Turner-Trauring wrote:
> > It sounds good, but if I don't call reactor.run() after connectSSL
> > doesn't happens anything... If I call reactor.run() after connectSSL, it
> > works properly...
> There are two types of client connections:
> 1. Connections you open when you first run the program. Call these before
> reactor.run() is called.
> 2. Connections that happen as result of events. Events are all dispatched
> by the reactor, so e.g. gui click or data received over network connection
> will result in functions being called by the reactor. These functions can
> also open new connections.
> The key here is to distinguish between the order of the code in the text
> file, and the order the code runs in. In the following example, the
> connectTCP will happen *after* reactor.run():
> # this will get called 10 seconds after reactor.run():
> def happensLater():
> reactor.callLater(10, happensLater)
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
It is possible to:
- start the reactor when I initialize my program (eg. in main)
- call connectTCP or connectSSL when I want and every time I want?
Something like this:
# connect to imap server and check for new mailboxes/messages
if __name__ == "__main__":
do something else
Because I can't implement this :}
I have started the implementation based on "Twisted Network Programming
Essential", but this book doesn't treat multiple connections...
More information about the Twisted-Python