how do I listen on a socket without sucking up all the CPU time?
Joshua Muskovitz
josh at open.com
Tue Oct 3 09:35:45 EDT 2000
> Why is the socket set to non-blocking? Why not set it to
> blocking so that the thread blocks until there's data to read?
This is one of those "um" questions. The answer is "um, well, the prototype
code I was given to start with set it to non-blocking." <insert sheepish
grin here>
The only reason I can thing of is that a separate thread needs to be able to
use the same socket to send requests (send and recv operate on the same
socket in different threads), but this may not be a valid reason either.
select.select worked great, but now I've got other problems, namely
figureing out why I'm no longer catching the KeyboardInterrupt exception I
used to be able to catch.
- j
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 80,000 Newsgroups - 16 Different Servers! =-----
More information about the Python-list
mailing list