473,513 Members | 2,399 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ping - statistics

Hello:

Is it possible to make "ping" from Python and get statistics like using command prompt from Windows?
How Can I capture them into variables?
Thanks

Pinging XXXX.XXXX.XXXX.XXXX with 32 bytes of data:

Reply from XXXX.XXXX.XXXX.XXXX: bytes=32 time<10ms TTL=255
Reply from XXXX.XXXX.XXXX.XXXX: bytes=32 time<10ms TTL=255
Reply from XXXX.XXXX.XXXX.XXXX: bytes=32 time<10ms TTL=255
Reply from XXXX.XXXX.XXXX.XXXX: bytes=32 time<10ms TTL=255

Ping statistics for XXXX.XXXX.XXXX.XXXX:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms

Jul 18 '05 #1
2 5327
> Alberto Vera wrote:

Is it possible to make "ping" from Python and get statistics like using command prompt from Windows?
How Can I capture them into variables?


The most direct approach for this kind of thing is often to use os.popen()
and the "re" module to execute the command and capture it's output, and
to parse the output to find the data of interest.

If you check the newsgroup/list archives (or maybe even Google) you will
also find references to "ping" implemented in Python.

-Peter
Jul 18 '05 #2
Alberto Vera wrote:
Hello:

Is it possible to make "ping" from Python and get statistics like using
command prompt from Windows?
How Can I capture them into variables?
Thanks


I once searched for ping-modules (which wasn't too easy) and found those:

http://www.python.org/~jeremy/python.html
ftp://ftp.visi.com/users/mdc/ping.py
Hey and I just checked if it is easier to them now :-() and I found one
more:

http://pynms.sourceforge.net/
has a ping-module/class
http://pynms.sourceforge.net/ping.html
and probably is cool if you want to do this network-stuff.

Finally I think the impressing Twisted-Framework had a ping functionality.
Christoph Becker-Freyseng

Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2237
by: Jason Rodman | last post by:
I have downloaded every example on how to create a ping utility in .Net in both VB and C#, but have been disappointed with the results. I have YET to find an example that returns consistent results...
0
7750
by: Ed | last post by:
I've attached some VB.NET code I've hacked together (some taken from MS examples & newsgroup postings) that will perform a ping or IcmpSendEcho using the icmp.dll (see this for more info:...
17
5030
by: romixnews | last post by:
Hi, I'm facing the problem of analyzing a memory allocation dynamic and object creation dynamics of a very big C++ application with a goal of optimizing its performance and eventually also...
4
1721
by: MLH | last post by:
C:\Docs\TitleWork>ping piedmonttriadtowing.dyndns.org Pinging piedmonttriadtowing.dyndns.org with 32 bytes of data: Reply from 70.60.253.195: bytes=32 time=49ms TTL=239 Reply from...
5
5570
by: Deepak | last post by:
I am programing a ping application which pings various centers . I used timer loop and it pings one by one. Now when i finish pinging one center it should wait for the ping_completed function to...
1
18438
by: Krish | last post by:
All, I have an offline application that works online for some data syncronization. For data syncronization I access a webservice. I want to show whether my application is online or not by checking...
6
3446
by: Dave Marden | last post by:
I currently use this routine in vbscript to ping computers and get the status of ping to determine whether to try to backup a machine, I am trying to change it to work with vb2003.net I am...
1
1331
by: Charlie of Bolton | last post by:
Hi, Need help to filter the proper value from a string, Here is a display from a ping command: Pinging 10.2.3.6 with 32 bytes of data: Request timed out. Request timed out.
2
2117
by: napstar | last post by:
I'm using the Ping Class to ping a location.If it is successful I copy a file across the network to the local machine and then delete it but if it isn't I move on. The problem is that the...
0
7264
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7166
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7386
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7106
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5094
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4749
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3236
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1601
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
805
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.