Advertisement
skip420

networkPing

Feb 20th, 2022
821
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. import subprocess
  2.  
  3. for ping in range(1,10):
  4.     address = "127.0.0." + str(ping)
  5.     res = subprocess.call(['ping', '-c', '3', address])
  6.     if res == 0:
  7.         print( "ping to", address, "OK")
  8.     elif res == 2:
  9.         print("no response from", address)
  10.     else:
  11.         print("ping to", address, "failed!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement