I need to be able to start and stop the soap server programmatically.

There doesn't seem to be a way to stop serve_forever without killing
the entire program.

On Wed, Jan 5, 2011 at 2:18 AM, Marcus Priesch <[email protected]> wrote:
>
> Hi Kevin,
>
> why do you want to exit the thread on demand ?
>
> wouldnt
>
>  t = threading.Thread (target = self._server.server_forever)
>  t.daemon = True
>  t.start ()
>
> be sufficient (i dont know exactly if there is a server_forever method
> but it would simply be a while True: handle_request() loop) ?
>
> however, as far as i understand your code you are witing after each
> handled request ?!?
>
> regards,
> m.
>
> Am Montag, den 03.01.2011, 17:02 -0500 schrieb Kevin Anthony:
> > I'm writing a SOAPpy server in a thread, and having a problem handling
> > the exiting
> >
> >
> > What happens is handle_request() blocks until a request comes in. so
> > the thread exit's normally once a request comes in, but the server
> > could sit running for hours before a request comes in.
> > is there a non-blocking method i can call before i call handle_request
> >
> >
> > I've played around with socket timeouts but haven't had much success.
> >  is there a way to do this?
> >
> >
> > here's my code current code:
> >
> >
> >         def run(self):
> >                 self._server = SOAPpy.SOAPServer(self._addr)
> >                 self._server.registerObject(self,self._NS)
> >                 logging.info("Starting Soap Server (ctrl+c to stop)")
> >                 while not self._stopevent.isSet():
> >                         self._server.handle_request()
> >                         self._stopevent.wait(self._sleepPeriod)
> >
> >
> >         def join(self, timeout=None):
> >                 self._stopevent.set()
> >                 threading.Thread.join(self, timeout)
> >                 self._server.server_close()
> >                 logging.warning("Exiting Thread :%s"
> > %(self.getName()))
> >
> >
> >
> > --
> > Thanks
> > Kevin Anthony
> > www.NoSideRacing.com
> > 732.793.3473
> >
> >
> > _______________________________________________
> > Soap mailing list
> > [email protected]
> > http://mail.python.org/mailman/listinfo/soap
>
>
> _______________________________________________
> Soap mailing list
> [email protected]
> http://mail.python.org/mailman/listinfo/soap



--
Thanks
Kevin Anthony
www.NoSideRacing.com
732.793.3473
_______________________________________________
Soap mailing list
[email protected]
http://mail.python.org/mailman/listinfo/soap

Reply via email to