()
| 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() |
no test coverage detected