![](https://secure.gravatar.com/avatar/71d29415b83286c89479f05f4e696b2d.jpg?s=120&d=mm&r=g)
On 9/11/06, glyph@divmod.com <glyph@divmod.com> wrote:
However, as dialtone said, it should be easy enough to write a non-blocking client; twisted's client support is just as good as its server support :)
Of course, sometimes this isn't possible at all (you're embedded in a closed source application, etc). The general answer is you need twisted's loop running on another thread or in another process and you need to make calls across this. A simple way is to spawn the reactor in a separate thread (IIRC not all reactors are safe to run on a thread other than the main one, check with someone more knowledgeable) and use the threadsafe built-in queue to push requests across (you just do a blocking pop on the "output" queue and you have the blocking semantics you wish, but this part is optional). This isn't a common use case for me, so there may be better or built-in ways of doing this. To summarize, Glyph and Dialtone are right, if you can rewrite you definitely should, but if you can't there are ways around it.