Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: Net::Ping output

by Anonymous Monk
on Aug 19, 2013 at 11:59 UTC ( #1050022=note: print w/replies, xml ) Need Help??

in reply to Net::Ping output

Net::Ping does not generate any output by itself, but you should be able to calculate any values you need yourself. From the POD:
# High precision syntax (requires Time::HiRes) $p = Net::Ping->new(); $p->hires(); ($ret, $duration, $ip) = $p->ping($host, 5.5); printf("$host [ip: $ip] is alive (packet return time: %.2f ms)\n", + 1000 * $duration) if $ret; $p->close();
Do you need help in making a basic pinging loop, or calculating minimum, maximum, average, standard deviation? Or finding the host's reverse DNS?

Replies are listed 'Best First'.
Re^2: Net::Ping output
by gaurav (Acolyte) on Aug 20, 2013 at 04:18 UTC

    Actually I want the same output as System-Ping command say, Tx packet,Rx Packets,TTL,RTT(max,min,avg),packet-loss.

      And you can get the same output. Ping n times, collect results in an array, calculate values, print them out (if necessary). Which part were you having trouble with?

        I am sorry ,but didn't get you .would you please elaborate more,because I have seen this code & it does not seems like to draw the required values

        $p = Net::Ping->new(); $p->hires(); ($ret, $duration, $ip) = $p->ping($host, 5.5); printf("$host [ip: $ip] is alive (packet return time: %.2f ms)\n", + 1000 * $duration) if $ret; $p->close();

        Now please tell me how can I calculate RTT,how I can get transmitted packets,recieved packets.Please!!!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1050022]
thezip vouches for that, but then forgets what he was vouching for...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2018-06-21 16:46 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (118 votes). Check out past polls.