MCPcopy Create free account
hub / github.com/InternScience/SciReason / check_ping

Function check_ping

opencompass/utils/network.py:84–92  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

82
83 # Method 3: Ping test (direct connection, no proxy)
84 def check_ping() -> bool:
85 param = '-n' if platform.system().lower() == 'windows' else '-c'
86 command = ['ping', param, '1', host]
87 try:
88 return subprocess.call(command,
89 stdout=subprocess.DEVNULL,
90 stderr=subprocess.DEVNULL) == 0
91 except subprocess.SubprocessError:
92 return False
93
94 # Try all methods
95 is_socket_connected = check_socket()

Callers 1

Calls 1

lowerMethod · 0.45

Tested by

no test coverage detected