Socket programming.

Christopher Petrilli petrilli at trump.amber.org
Fri Jul 2 13:01:37 EDT 1999


Kjetil Ødegaard <kjetilod at stud.ntnu.no> wrote:
> My current implementation is threaded (using fork()); one thread for
> user interaction and one for server output.  It uses blocking
> sockets.  It works ok, but I've read some docs here and there (amongst
> them the Socket Programming HOWTO on www.python.org) and I get the
> feeling I should be using select() and non-blocking sockets.  Also,
> I'm not sure I want to use fork() -- it seems very low-level and
> depends on a Unix-like system.

First, fork() isn't really threading... if you want to do threading, then
you should use the threading module, if it' ssupported on your platform.

Second, for that kind of thign, take a look at asyncore and asynchat,
the first of which I've written documentation for that will be released
in the next itteration of the Python library reference.  asynchat
should be able to do what you want.

Chris
-- 
| Christopher Petrilli                      ``Television is bubble-gum for
| petrilli at amber.org                          the mind.''-Frank Lloyd Wright




More information about the Python-list mailing list