socket.recvfrom() & sendto()

Fredrik Lundh fredrik at pythonware.com
Wed May 9 02:40:44 EDT 2001


Ron Johnson wrote:
> > It is never "stalled" at a select(); asyncore uses non-blocking
> > sockets.  select() returns immediately with lists of those sockets
> > which are ready to write and those sockets which are ready to read.
>
> Not to pick a nit, but doesn't execution stall at select() if
> there is no data coming in to the server.  For example: a small
> chat server when no one happens to be chatting.

if you set the select timeout short enough, you can poll the network
from an UI background task (e.g. Tk's idletask).

for heavier loads, it's probably better to use a separate UI thread
(if you really like threads, add a dispatcher thread and one or more
worker threads to the mix as well...)

Cheers /F





More information about the Python-list mailing list