On Dec 5, 6:22 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Wed, 05 Dec 2007 18:20:35 -0300, Bret <[EMAIL PROTECTED]> escribió: > > > I just tried changing this so that I now have a threading.Event() > > called self.done, which is set within the body of the shutdown() > > method. The serverWrapper loop now looks like this: > > > def serverWrapper(): > > while True: > > server.handle_request() > > if self.done.isSet(): > > break > > > This works, but only if I follow the shutdown() rpc call a few seconds > > later with ... something else to cause handle_request() to complete > > again. Obviously, not quite the right approach.... > > You could try setting a reasonable timeout on the listening socket; I > would override the server_bind method, calling self.socket.settimeout(xxx) > before calling the inherited method. I've never actually done it with a > SimpleXMLRPCServer, but *should* work. Don't use a very small timeout, > because it affects *all* subsequent operations. > > -- > Gabriel Genellina
Try this: def __init__(self, host, port): self.done = False server = SimpleXMLRPCServer((host, port)) : : Bunch of server.register_function calls : def serverWrapper(): try: while not self.done: server.handle_request() except: pass Your shutdown method becomes: def shutdown(self): self.done = True HTH -Edward Kozlowski -- http://mail.python.org/mailman/listinfo/python-list