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 July 8th, 2004, 08:29 AM
luckyboy luckyboy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 57 luckyboy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 46 m 58 sec
Reputation Power: 5
Net : :

In perl they use
use Net::Ping;
In python ????

Thanks

Reply With Quote
  #2  
Old July 8th, 2004, 05:03 PM
sandro sandro is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Location: Belgium
Posts: 3 sandro User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Re: Net::

I don't know of something similar in standard python modules. You could try, if you really need it:
Code:
output = os.popen('ping x.x.x.x')

(output being a file object, your command's stdout, actually)

Reply With Quote
  #3  
Old July 8th, 2004, 07:14 PM
Grim Archon's Avatar
Grim Archon Grim Archon is offline
Mini me.
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2003
Location: Cambridge, UK
Posts: 783 Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)  Folding Points: 1488 Folding Title: Novice Folder
Time spent in forums: 3 Days 2 h 15 m 57 sec
Reputation Power: 8
Send a message via MSN to Grim Archon
Try searching this forum or
google python ping module

There are a few examples but I agree with sandro - unless you have serious performance issue why not use ping as supplied with your os. It is easy enough to parse the output.

grim
__________________
*** Experimental Python Markup CGI V2 ***

Reply With Quote
  #4  
Old July 9th, 2004, 04:35 AM
luckyboy luckyboy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 57 luckyboy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 46 m 58 sec
Reputation Power: 5
ping servers

I have a list of hosts and that i want to ping, If successfull put ok for each successfully pinged hosts and no if unsuccessfull ping.

Thanks

Reply With Quote
  #5  
Old July 9th, 2004, 07:06 AM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,536 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 10 m 32 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
Well. All you have to do is loop over those addresses and ping them using the 'ping' facility supplied by your OS and the address. For example.

Code:
pseudocode
#!/usr/bin/env python

from os import popen

pings = (...some addesses you wish to ping...)

for ping in pings:
    returned = popen('ping %s' % ping)
    if returned is successful:
        ...
        do thi
        ...
    else:
        ...
        do thi
        ...


Thats the basic idea, but, im sure it wont take you long to get this working .

Have fun,

Mark.
__________________
programming language development: www.netytan.com Hula


Last edited by netytan : July 9th, 2004 at 07:08 AM.

Reply With Quote
  #6  
Old July 9th, 2004, 10:17 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
You should find my attachment usefull
Attached Files
File Type: zip ping.tar.gz.zip (15.0 KB, 222 views)

Reply With Quote
  #7  
Old July 12th, 2004, 10:46 AM
luckyboy luckyboy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 57 luckyboy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 46 m 58 sec
Reputation Power: 5
Thanks for the attached file unfortunately i am unable to use it i think it's linux format, i am not a linux person.

Thanks

Reply With Quote
  #8  
Old July 12th, 2004, 02:29 PM
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
You can just copy the module to your package dir.. its what i have done in windows and it works

Reply With Quote
  #9  
Old July 15th, 2004, 04:51 AM
luckyboy luckyboy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 57 luckyboy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 46 m 58 sec
Reputation Power: 5
Hi
Thanks for your help I managed to copy the modules to dir. As i am a beginner to programming and crowling i am going to ask for more help " How do i use these modules to amend my previously posted code.I am confused with Reading books and other tutorial sites. I like to learn with more examples like step by step guide and this is the best site and best pupil to learn.Please do not get irritated with me.
Thanks

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Net : :


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 4 hosted by Hostway
Stay green...Green IT