Pinging servers in Python

This function works in any OS (Unix, Linux, macOS, and Windows)Python 2 and Python 3 EDITS:By @radato os.system was replaced by subprocess.call. This avoids shell injection vulnerability in cases where your hostname string might not be validated. Note that, according to @ikrase on Windows this function will still return True if you get a Destination Host Unreachable error. Explanation The command is ping in both Windows and … Read more

Pinging servers in Python

This function works in any OS (Unix, Linux, macOS, and Windows)Python 2 and Python 3 EDITS:By @radato os.system was replaced by subprocess.call. This avoids shell injection vulnerability in cases where your hostname string might not be validated. Note that, according to @ikrase on Windows this function will still return True if you get a Destination Host Unreachable error. Explanation The command is ping in both Windows and … Read more