How best to achieve asynchronous socket input and output?

Kylotan kylotan at hotmail.com
Mon Nov 24 21:22:18 EST 2003


"Fredrik Lundh" <fredrik at pythonware.com> wrote in message news:<mailman.1020.1069669544.702.python-list at python.org>...
> Kylotan wrote:
> 
> > I'm writing a wxPython telnet-like application that needs to be able
> > to send and receive data independently of each other. The asyncore
> > library comes close to what I want, but still requires I have a
> > blocked thread (the one that calls asyncore.loop() ).
> 
> using a timer to poll asyncore tends to work pretty well.
> 
> for examples, see "Managing Downloads" and "Keeping the network
> traffic going" on this page:
> 
>     http://effbot.org/zone/effnews-3.htm
> 
> (you can search for "poll" to find the relevant portions)

Ok, so from what you're saying, and what the others in the thread have
said, it seems like I can't get around having to poll the sockets
periodically somehow, in another thread. I guess I will just make a
thread for all my sockets and pass it relevant callbacks for whenever
select decides that a socket has some data incoming.

-- 
Ben Sizer




More information about the Python-list mailing list