Re: How can I kill CGIHTTPServer ?

2008-02-11 Thread eching
On Feb 11, 10:24 am, "Gabriel Genellina" <[EMAIL PROTECTED]>
wrote:
> En Mon, 11 Feb 2008 04:18:04 -0200, eching <[EMAIL PROTECTED]>
> escribi�:
>
> > I'm running CGIHTTPServer with the serve_forever method and I cannot
> > get the darn thing to stop unless I kill the command prompt its
> > running in.  I searched for similar posts here and found this:
>
> See this thread from last year; it's about XMLRPC but the idea is the 
> same.http://groups.google.com/group/comp.lang.python/browse_thread/thread/...
>
> --
> Gabriel Genellina

That looks about like what I need.  Thanks for the link!
-- 
http://mail.python.org/mailman/listinfo/python-list

How can I kill CGIHTTPServer ?

2008-02-10 Thread eching
I'm running CGIHTTPServer with the serve_forever method and I cannot
get the darn thing to stop unless I kill the command prompt its
running in.  I searched for similar posts here and found this:

http://groups.google.com/group/comp.lang.python/browse_thread/thread/6879d74ad7679349/ff7d0aa2be964767?lnk=gst&q=HTTPServer+kill#ff7d0aa2be964767

But there doesn't seem to be a definitive answer.  I tried one of the
last proposed solutions:

class Server(SocketServer.ThreadingMixIn, SocketServer.TCPServer):
pause = 0.25
allow_reuse_address = True

def __init__(self, server_address, RequestHandlerClass):
SocketServer.TCPServer.__init__(self, server_address,
RequestHandlerClass)
self.socket.settimeout(self.pause)
self.serving = 1
...

def serve_forever(self):
while self.serving:
self.handle_request()

And that worked, but the last post in the thread suggested '...this
would cause timeouts in the middle of handling request whenever a
client is slow'

Can anyone comment on this solution or have other possible solutions?
Eventually I probably will want this to run as a windows service to
serve up some internal apps, so it would be great if I could the
server to shutdown gracefully.

Thanks in advance,
Eric
-- 
http://mail.python.org/mailman/listinfo/python-list