socket.recvfrom() & sendto()

Steve Holden sholden at holdenweb.com
Tue May 8 03:16:15 EDT 2001


"Ron Johnson" <ron.l.johnson at home.com> wrote in ...
[ ... ]
>
> It seems like the server *and* the client both must use asyncore.
> But does asyncore, underneath it all, sit at select.select() waiting
> on the next readable socket?  So if the client is also using asyncore,
> does it need a thread for network IO and a thread for user interaction,
> and the 2 threads talk to each other?
>
Nope. The advantage of asyncore, and Medusa, is that you don't *need*
separate threads. You create a separate object for each dialog (connection),
which holds the stat information for that connection, and the whole program
just becomes one big select() loop, where each connection object is told
when there is data to be read, when it can write, and so on.

So it's a single thread, processing multiple objects asynchronously,
depending on events which are detected by the use of select().

When you start, it's about as weird as your first GUI-based program --
event-driven programs are held together by string!

regards
 Steve





More information about the Python-list mailing list