Handling more than one request on a socket

Jeff Grimmett grimmtoothtoo at yahoo.com
Wed Aug 29 04:44:38 CEST 2001

Hi, pythonistas,

I'm trying to come to grips with the issue of dealing with sockets,
or, more precisely, a socket that can accept and process 'n' number of
requests on a particular address.

Right now I'm going the route of opening an inet streaming socket,
binding it to the port, and listen()ing for requests. For example, for
a telnet port:

   s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
   s.bind(('', 23))

... then ... ?  I've tried a number of approaches, but so far all I
can get to work is a single connection at a time, and in most cases
it's good for one recv().

This is an issue I'm going to be looking at in a lot of cases, so I'd
like to iron it out now if I can. Any suggestions on where to start?

More information about the Python-list mailing list