diff --git a/control/discovery.py b/control/discovery.py index d91ee23de..18a9e83ed 100644 --- a/control/discovery.py +++ b/control/discovery.py @@ -1022,6 +1022,8 @@ def start_service(self): """Enable listening on the server side.""" sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + # Set the SO_REUSEADDR option + sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) sock.bind((self.discovery_addr, int(self.discovery_port))) sock.listen(MAX_CONNECTION) sock.setblocking(False)