SimpleXMLRPCServer Releasing Ports
Skip Montanaro
skip at pobox.com
Tue Oct 8 12:29:13 EDT 2002
John> I have a script running, using SimpleXMLRPCServer, which works OK.
John> Except, when I stop, and restart the script, I receive the error,
John> "Address already in use". Is there something I can do, like a
John> destructor, to tidy up, so that the script can be restarted?
You should be able to subclass the SimpleXMLRPCServer class and override the
server_bind method to set the socket to allow address reuse, e.g.:
class XMLRPCServer(SimpleXMLRPCServer.SimpleXMLRPCServer):
def server_bind(self):
self.socket.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1)
self.socket.bind(self.server_address)
then instantiate that instead of the SimpleXMLRPCServer class.
--
Skip Montanaro - skip at pobox.com
"Airplanes don't fly until the paperwork equals the weight of the
aircraft. Same with i18N." - from the "Perl, Unicode and i18N FAQ"
More information about the Python-list
mailing list