[Tutor] Infinite Loops (and threads)

زياد بن عبدالعزيز البا زياد بن عبدالعزيز البا
Sun Dec 24 18:58:55 CET 2006


Luke Paireepinart <rabidpoobear at gmail.com> On Sun, 24 Dec 2006 10:02:19
-0600 wrote: > Kent Johnson wrote:
> Kent et. al.,
> 
> I'm writing something that has to do with sockets.
> I need to recv any incoming packets from the socket.
> I will have potentially hundreds of separate sockets open in a single 
> application.
> I was just going to create a thread for each, so I could receive from 
> them separately.
> 
> Alternately, I figured I could read from each socket in sequence if I 
> could get the recv method to not block until it gets input,
> so I tried this,
 <snip>
> 
> Thanks,
> -Luke
Use "import select" and read about it for more information (i.e.
help(select) within Python shell).

I advice you (and others interested in writing Python code dealing
with sockets) *very strongly* to read the following:
	http://www.amk.ca/python/howto/sockets/

(Currently, I'm having trouble accessing that URL. I don't know if
it's my ISP or the the site is down.)
I hope that helps.
Ziyad.


More information about the Tutor mailing list