Implement this instead of manual/static socket selection: import socket sock = socket.socket() sock.bind(('', 0)) sock.getsockname()[1] => this makes the OS select a free socket.
Implement this instead of manual/static socket selection:
import socket
sock = socket.socket()
sock.bind(('', 0))
sock.getsockname()[1]
=> this makes the OS select a free socket.