Adding socket option to server socket to bind to port in use to make restarts faster and more consistent

This commit is contained in:
Jake Herbst
2022-05-25 21:16:40 -04:00
parent f16bbe0e82
commit 605066ae76
+2
View File
@@ -30,6 +30,8 @@ FORMAT = 'utf-8'
DISCONNECT_MESSAGE = "!DISCONNECT"
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
try:
server.bind(ADDR)
except BaseException: