[Twisted-Python] Multiple clients

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Fri Jun 18 09:01:02 EDT 2010

On 10:36 am, bszabolcs at gmail.com wrote:
>Can somebody send me a small example how to use multiple clients at 
>time? For example to connect to 3 different IMAP server. I need this 
>I'm working on an email client engine. I can connect to POP/IMAP/SMTP 
>to download and send messages, but I have created those methods 
>and each time when I check for new messages or send a message I use
>reactor.run() and reactor.stop(). But calling it multiple times is a

>So I need something:
>- when I press button1, the application checks for new messages on POP
>- when I press button2, the application checks for new messages on IMAP

How about:

  def onbutton1(self):

  def onbutton2(self):
>I know how to check for messages on IMAP/POP server, but I don't know 
>how to
>do it periodically with twisted...

Periodically as in "once every N seconds"?  Check out reactor.callLater 
or twisted.internet.task.LoopingCall.


More information about the Twisted-Python mailing list