[Twisted-web] Mingling client and server code

Andreas Kostyrka andreas at kostyrka.org
Thu Jul 1 11:45:09 MDT 2004

On Thu, 2004-07-01 at 17:43, Dominic Fox wrote:
> I have a server application that needs to send and receive email,
> whilst serving web pages. Although it's fairly straightforward just to
> use poplib and smtplib and perform mailing operations in a background
> thread, I'd rather make use of the mail libraries in Twisted and
> perform these tasks asynchronously. My question is, assuming an
> application that's set up like this:
> site = server.Site(root)
> application = service.Application('web')
> sc = service.IServiceCollection(application)
> i = internet.TCPServer(8001, site)
> t = internet.TimerService(10, checkInbox)
> i.setServiceParent(sc)
> how do I write the Twisted client code inside checkInbox()? Presumably
> it needs to create a client object, get the application's reactor to
> attempt a connection, and get the object to handle callbacks from
> reactor. But how do we get a reference to the application's reactor to
> begin with?
from twisted.internet import reactor


More information about the Twisted-web mailing list