|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Net : :
In perl they use
use Net::Ping; In python ???? Thanks |
|
#2
|
|||
|
|||
|
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) |
|
#3
|
||||
|
||||
|
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 *** |
|
#4
|
|||
|
|||
|
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 |
|
#5
|
||||
|
||||
|
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. Last edited by netytan : July 9th, 2004 at 07:08 AM. |
|
#6
|
||||
|
||||
|
You should find my attachment usefull
__________________
IE QUOTE | PHP Manual | Google | C/C++ Compiler | Linux Tutorials | General Stuff Game Dev |
|
#7
|
|||
|
|||
|
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 |
|
#8
|
||||
|
||||
|
You can just copy the module to your package dir.. its what i have done in windows and it works
![]() |
|
#9
|
|||
|
|||
|
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 |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > Net : : |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|