[Twisted-web] Mingling client and server code

Dominic Fox dominic.fox at gmail.com
Thu Jul 1 13:06:42 MDT 2004


Just like that? Cool.

Twisted has been pretty fun so far.

thanks,
Dominic

On Thu, 01 Jul 2004 19:45:09 +0200, Andreas Kostyrka
<andreas at kostyrka.org> wrote:
> 
> 
> 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
> 
> Andreas
> 
> _______________________________________________
> Twisted-web mailing list
> Twisted-web at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
> 




-- 
// Dream in black and white -
// model cities, shooting up in the air



More information about the Twisted-web mailing list