ping - statistics

Discussion in 'Python' started by Alberto Vera, Oct 22, 2003.

  1. Alberto Vera

    Alberto Vera Guest

    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
    Alberto Vera, Oct 22, 2003
    #1
    1. Advertising

  2. Alberto Vera

    Peter Hansen Guest

    > 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
    Peter Hansen, Oct 23, 2003
    #2
    1. Advertising

  3. 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
    Christoph Becker-Freyseng, Oct 24, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Abdelhalim

    VHDL features Usage statistics

    Abdelhalim, May 18, 2004, in forum: VHDL
    Replies:
    3
    Views:
    694
    Abdelhalim
    May 19, 2004
  2. Paps

    Site Statistics

    Paps, Nov 24, 2003, in forum: ASP .Net
    Replies:
    5
    Views:
    449
    Jacob Yang [MSFT]
    Nov 27, 2003
  3. Lucas Tam
    Replies:
    2
    Views:
    421
    John Rivers
    Aug 27, 2005
  4. Mr Newbie

    Site Statistics - Need Display Package

    Mr Newbie, Dec 26, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    303
    Christopher Reed
    Dec 26, 2005
  5. Mark

    Learning with statistics

    Mark, Jun 27, 2003, in forum: Java
    Replies:
    4
    Views:
    876
    Marc Rochkind
    Jun 30, 2003
Loading...

Share This Page