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

Function is_port_in_use

tests/ce/deploy/deploy.py:44–47  ·  view source on GitHub ↗

检查端口是否被占用

(port)

Source from the content-addressed store, hash-verified

42
43
44def is_port_in_use(port):
45 """检查端口是否被占用"""
46 with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
47 return s.connect_ex(("localhost", port)) == 0
48
49
50def get_available_port(env_key: str, default_start: int):

Callers 3

get_available_portFunction · 0.85
service_statusFunction · 0.85
generateFunction · 0.85

Calls 1

socketMethod · 0.80

Tested by

no test coverage detected