Set socket.SO_REUSEADDR, so the server doesn't fail to reboot

This commit is contained in:
Fierelier 2022-07-05 15:28:39 +02:00
parent 1b36386eae
commit 305e9a4307

View File

@ -34,6 +34,7 @@ global makeServer
def makeServer(host,port,https):
print("Opening " +str(host)+ ":" +str(port)+ " (" +str(https)+ ") ...")
serverSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
serverSocket.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1)
serverSocket.bind((host,port))
if https:
proto = False