Feature Requests item #1193577, was opened at 2005-05-02 03:04 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1193577&group_id=5470
Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: paul rubin (phr) Assigned to: Nobody/Anonymous (nobody) Summary: add server.shutdown() method and daemon arg to SocketServer Initial Comment: First of all the daemon_threads property on socket servers should be added as an optional arg to the server constructor, so you can say: TCPServer(..., daemon_threads=True).serve_forever() instead of temp = TCPServer(...) temp.daemon_threads=True temp.serve_forever Secondly there should be a way to STOP the server, once you've started serving forever! A request handler should be able to say self.server.stop_serving() This would work by setting a flag in the server object. The serve_forever loop would use select with a timeout (default 0.5 sec, also settable as an optional arg to the server constructor) or alternatively set a timeout on the socket object. So it would block listening for new connections, but every 0.5 sec it would check the stop_serving flag and break out of the loop if the flag was set. This method was suggested by Skip Montanaro in a clpy thread about how to stop SocketServer and it's useful enough that I think it should be part of the standard impl. I can make a patch if it's not obvious how to do it. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1193577&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com