multi-threaded webcam with SimpleAsyncHTTPServer.py

Ray Schumacher subscriber100 at rjs.org
Tue Jan 9 00:14:35 EST 2007


 >>Question, though: how can I unblock asyncore.loop(), or at least 
be >>able to interrupt it?
 >Why do you want to do that?

I was then thinking along the lines of a Netmeeting/visual chat 
program, rather than a daemon-type server, where one might want to 
terminate more quickly.
Searching further, I see that a common idiom is like:

while some_condition:
     try: asyncore.loop(timeout=1, count = 1)
     except KeyboardInterrupt: break

or, spawn asyncore.loop() threads. Zope and Medusa seem to use a 
variety of methods.
A regular web-cam program serving up 2 or 3 cams on one machine will 
require more thought on my part, of course. I only run one cam, but a 
friend runs 3 and is pissed at the X10 software he paid for.
Thanks,
Ray




More information about the Python-list mailing list