[Twisted-Python] newbie: asynchronous client

Jp Calderone exarkun at intarweb.us
Mon Feb 17 18:44:28 EST 2003

On Mon, Feb 17, 2003 at 05:56:56PM -0500, Joshua Bloom wrote:
> I'd like to set up a non-blocking TCP client that loops indefinately,
> waiting for the user to input something (which gets sent to the server)
> but also responds to server replies whenever it can. So after I send
> "factorial 1234" to the server, I'd like to be able to say "1 + 2" before
> the server returns and get a response from that.
> Thanks in advance for any pointers.

  Non-blocking user-input is the hardest part of this program.  That said,
if you go with one of the GUI toolkits that Twisted is integrated with, it
should be no problem (Qt, Gtk, Tk, PyUI, curses, wxWindows).  Their
mainloops are mashed into Twisted's in various ways, letting network and
user events happily co-exist.  If you go with another toolkit, you'll have
to find some way to accomplish the same mainloop integration.

  Examples for GUI apps are (surprise) in doc/examples/


"Pascal is Pascal is Pascal is dog meat."
                -- M. Devine and P. Larson, Computer Science 340
 up 9 days, 4:28, 3 users, load average: 0.02, 0.06, 0.02
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20030217/2b816604/attachment.pgp 

More information about the Twisted-Python mailing list