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)
| 180 | |
| 181 | |
| 182 | def 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 | |
| 194 | def get_paddle_model_path(base_model_name: str) -> str: |