|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
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
__________________
IE QUOTE | PHP Manual | Google | C/C++ Compiler | Linux Tutorials | General Stuff Game Dev |
|
#2
|
|||
|
|||
|
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. |
|
#3
|
||||
|
||||
|
Kool thanx dont know why i didnt think of that before
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > pings |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|