Skip to content

Commit

Permalink
Add SO_REUSEADDR option before binding to port
Browse files Browse the repository at this point in the history
  • Loading branch information
elias-a committed Mar 10, 2024
1 parent 8c81da5 commit 2367f4a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions vpython/no_notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def signal_handler(signal, frame):

def find_free_port(port):
s = socket.socket()
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind(('', port))
return s.getsockname()[1]

Expand Down

0 comments on commit 2367f4a

Please sign in to comment.