Fix [Errno 98] Address already in use
This commit is contained in:
parent
91f6364d95
commit
1593f8df02
@ -7,6 +7,7 @@
|
||||
# v.0.9 20/08/2021 First version
|
||||
# v.1.0 10/05/2022 Fix for more than 1 VIP
|
||||
# v.1.1 11/05/2022 Fix for INIT status VIP
|
||||
# v.1.2 17/06/2022 Fix "[Errno 98] Address already in use" when restarting service
|
||||
#
|
||||
|
||||
import http.server
|
||||
@ -64,7 +65,12 @@ class RequestHandler(http.server.SimpleHTTPRequestHandler):
|
||||
else:
|
||||
self.send_response(200)
|
||||
|
||||
with socketserver.TCPServer(("", PORT), RequestHandler) as httpd:
|
||||
|
||||
class TCPServerReuseAddr(socketserver.TCPServer):
|
||||
allow_reuse_address = True
|
||||
|
||||
|
||||
with TCPServerReuseAddr(("", PORT), RequestHandler) as httpd:
|
||||
print("Serving at port", PORT)
|
||||
httpd.serve_forever()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user