-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
For both zmq and ymq, if user didn't specify the port, then port should be 0, and we should let OS to bind with available port, then return it
current behavior is we use get_available_tcp_port, then use this port to actually listen:
def get_available_tcp_port(hostname: str = "127.0.0.1") -> int:
with socket.socket(socket.AddressFamily.AF_INET, socket.SocketKind.SOCK_STREAM) as sock:
sock.bind((hostname, 0))
return sock.getsockname()[1]But there is a gap between we get_available_tcp_port and then use it, in this gap, other program might use the port, and it's not consistent. we should bind it when create zmq/ymq connection and return the port number
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels