Hi all, I bet everybody knows exactly what I am about to ask about:
''' A server serves for a while, then drops on its knees, tries to restart, but... the port is busy, the TCP says "Address already in use". ''' And, I think I know the answer: setsockopt(REUSEADDR)... The problem is: I am trying to use a very-high level far-away-from-socket class ("TCPServer"); or to be 100% honest, - an even higher-level async version of it (like in http://www.python.org/doc/2.6/library/socketserver.html?highlight=tcpserver#asynchronous-mixins). What I came up with so far is this: >>> from SocketServer import * >>> s = TCPServer( ('', 32123), None) >>> dir(s) ['RequestHandlerClass', '__doc__', '__init__', '__module__', 'address_family', 'allow_reuse_address', 'close_request', 'fileno', 'finish_request', 'get_request', 'handle_error', 'handle_request', 'process_request', 'request_queue_size', 'serve_forever', 'server_activate', 'server_address', 'server_bind', 'server_close', 'socket', 'socket_type', 'verify_request'] Aha! My bet is (was): >>> s.allow_reuse_address=1 should do the trick. But it doesn't. (:___. The question is: how to set up TCPServer correctly to reuse the port right away. Please give a hand. I acknowledge that I am trying to hack it rather then looking at all the web 1st: sorry if I am spamming this list while good documentation exists. But does it? :-#).
-- http://mail.python.org/mailman/listinfo/python-list