Thread: pings

    #1
  1. Only the strong survives!!.
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Feb 2003
    Location
    A World of wonders.
    Posts
    5,583
    Rep Power
    407

    pings


    If i was to create a program that pings a website to make sure that its still up, how would i get it to not give me the ping info but to check it to see if its good, this is kinda like my recent post but different

    Code:
    from os import *
    
    if system('ping -n 1 -w 512 ip here') < 1:
       print 'good'
    else:
       print 'bad'
    I realized that on my recent post i was doing things truely wrong, anyways instead of printing good.. it will print all the pings reply and then good after it ( or bad ) but all i want is to just show me good or bad
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Posts
    624
    Rep Power
    34
    Redirect the output of ping to nul.

    Code:
    from os import *
    
    if system('ping -n 1 -w 512 ip here > nul') < 1:
       print 'good'
    else:
       print 'bad'
    (or /dev/null on linux)

    Though, your last post in the other thread looked like it should work. You need to be a bit more careful with ping - if you are testing remote sites, they might have a firewall or ISP which blocks ping requests.
  4. #3
  5. Only the strong survives!!.
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Feb 2003
    Location
    A World of wonders.
    Posts
    5,583
    Rep Power
    407
    Kool thanx dont know why i didnt think of that before

IMN logo majestic logo threadwatch logo seochat tools logo