Net : :
In perl they use
In python ????
I don't know of something similar in standard python modules. You could try, if you really need it:
(output being a file object, your command's stdout, actually)
output = os.popen('ping x.x.x.x')
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.
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.
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.
Thats the basic idea, but, im sure it wont take you long to get this working .
from os import popen
pings = (...some addesses you wish to ping...)
for ping in pings:
returned = popen('ping %s' % ping)
if returned is successful:
Last edited by netytan; July 9th, 2004 at 06:08 AM.
You should find my attachment usefull
July 12th, 2004, 09:46 AM
Thanks for the attached file unfortunately i am unable to use it i think it's linux format, i am not a linux person.
July 12th, 2004, 01:29 PM
You can just copy the module to your package dir.. its what i have done in windows and it works
July 15th, 2004, 03:51 AM
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.