Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 11th, 2004, 03:51 AM
xlordt's Avatar
xlordt xlordt is offline
Only the strong survives!!.
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Feb 2003
Location: A World of wonders.
Posts: 5,553 xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)  Folding Points: 110809 Folding Title: Super Ultimate Folder - Level 1Folding Points: 110809 Folding Title: Super Ultimate Folder - Level 1Folding Points: 110809 Folding Title: Super Ultimate Folder - Level 1Folding Points: 110809 Folding Title: Super Ultimate Folder - Level 1Folding Points: 110809 Folding Title: Super Ultimate Folder - Level 1Folding Points: 110809 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 1 Month 3 h 36 m 8 sec
Reputation Power: 378
Send a message via ICQ to xlordt Send a message via AIM to xlordt Send a message via MSN to xlordt Send a message via Yahoo to xlordt Send a message via Google Talk to xlordt Send a message via Skype to xlordt
Facebook MySpace
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

Reply With Quote
  #2  
Old May 11th, 2004, 04:08 AM
sfb sfb is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 447 sfb User rank is Corporal (100 - 500 Reputation Level)sfb User rank is Corporal (100 - 500 Reputation Level)sfb User rank is Corporal (100 - 500 Reputation Level)sfb User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 1 h 43 m 45 sec
Reputation Power: 9
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.

Reply With Quote
  #3  
Old May 11th, 2004, 04:15 AM
xlordt's Avatar
xlordt xlordt is offline
Only the strong survives!!.
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Feb 2003
Location: A World of wonders.
Posts: 5,553 xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)  Folding Points: 110809 Folding Title: Super Ultimate Folder - Level 1Folding Points: 110809 Folding Title: Super Ultimate Folder - Level 1Folding Points: 110809 Folding Title: Super Ultimate Folder - Level 1Folding Points: 110809 Folding Title: Super Ultimate Folder - Level 1Folding Points: 110809 Folding Title: Super Ultimate Folder - Level 1Folding Points: 110809 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 1 Month 3 h 36 m 8 sec
Reputation Power: 378
Send a message via ICQ to xlordt Send a message via AIM to xlordt Send a message via MSN to xlordt Send a message via Yahoo to xlordt Send a message via Google Talk to xlordt Send a message via Skype to xlordt
Facebook MySpace
Kool thanx dont know why i didnt think of that before

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > pings


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT