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

Function is_port_open

tests/model_loader/utils.py:182–191  ·  view source on GitHub ↗

Check if a TCP port is open on the given host. Returns True if connection succeeds, False otherwise.

(host: str, port: int, timeout=1.0)

Source from the content-addressed store, hash-verified

180
181
182def is_port_open(host: str, port: int, timeout=1.0):
183 """
184 Check if a TCP port is open on the given host.
185 Returns True if connection succeeds, False otherwise.
186 """
187 try:
188 with socket.create_connection((host, port), timeout):
189 return True
190 except Exception:
191 return False
192
193
194def get_paddle_model_path(base_model_name: str) -> str:

Callers 1

clean_portsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected