[Twisted-Python] Multiple clients
glyph at twistedmatrix.com
Fri Jun 18 12:24:54 EDT 2010
On Jun 18, 2010, at 8:25 AM, Szabolcs Balogh wrote:
> Than how can I start checking for messages for different accounts (When I have
> finished checking the messages for the first account to start checking for the
> next account, and so on...)?
The whole *point* of the "reactor" is to allow multiple connections (and timed calls) to be serviced simultaneously.
When you have "finished checking messages" for the first account, presumably there is a callback of some kind; most likely 'connectionLost()'. In connectionLost, you can just call connectTCP again with a protocol factory pointed at the second account.
This is actually a FAQ:
Hopefully this helps.
This is a hard question to answer in a way where the next asker will actually find the answer, since the answer is really "just call a method", and the asker needs to understand that they can call any of these methods at any time. If you have any idea as to how the FAQ could be improved so that you might have found your answer while searching around, please let us know :). For example: the way you phrased your requirement here, "When I have done X, start doing X", even *sounds* like an event-driven program - 'def iHaveFinishedChecking(self): next.startChecking()' - so you were clearly on the right track. Why did you think you needed to run the reactor again in order to accomplish this?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Twisted-Python