[Twisted-Python] New user questions

snacktime snacktime at gmail.com
Sun Feb 6 16:30:55 EST 2005

On Sun, 06 Feb 2005 16:17:17 -0500, Itamar Shtull-Trauring
<itamar at itamarst.org> wrote:
> On Sun, 2005-02-06 at 12:12 -0800, snacktime wrote:
> > Maybe someone could show me the basic logic of how I would structure
> > the following to be non blocking?
> >
> > 1.  Client sends message to server
> > 2.  Server does an https POST to another server and gets a response
> > 3.  Server sends a message back to the client and closes the connection.
> Server receives data from client -> server sends POST to another server.
> Server receives response from another server -> server sends message
> back to client and closes connection.
> Server sending POST would probably use twisted.web.client and be a
> single function call, but internally be:
> Open connection to another server.
> Connection made -> send HTTP request.
> HTTP response receoved -> do something.
> Receiving data is:
> Received data -> check if we've received enough to process protocol
> message, if so process message, otherwise buffer data.

Ok, so basically I have to write my application so it does not block,
which means anything that does block has to be rewritten using
appropriate twisted components that don't block.  For instance, there
isn't a way to use urllib2 to do the POST and make it not block,

So I guess the main problem that arises is when calling some code that
blocks, but there is no twisted component that you can use to make the
code non blocking.  In which case you have to resort to using threads
or processes correct?


More information about the Twisted-Python mailing list