MCPcopy
hub / github.com/HKUDS/DeepCode / is_port_in_use

Function is_port_in_use

deepcode.py:126–129  ·  view source on GitHub ↗

Check if a port is in use (cross-platform)

(port: int)

Source from the content-addressed store, hash-verified

124
125
126def is_port_in_use(port: int) -> bool:
127 """Check if a port is in use (cross-platform)"""
128 with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
129 return s.connect_ex(("localhost", port)) == 0
130
131
132def kill_process_on_port(port: int):

Callers 2

cleanup_portsFunction · 0.85
cleanup_processesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected