MCPcopy Create free account
hub / github.com/PaddlePaddle/FastDeploy / get_random_port

Function get_random_port

fastdeploy/utils.py:598–606  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

596
597
598def get_random_port():
599 while True:
600 port = random.randint(49152, 65535)
601 with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
602 try:
603 s.bind(("0.0.0.0", port))
604 return port
605 except OSError:
606 continue
607
608
609def parse_ports(ports):

Callers

nothing calls this directly

Calls 2

socketMethod · 0.80
bindMethod · 0.80

Tested by

no test coverage detected