After a some struggle with my local firewall and such, I have installed
Time::Hires and have placed Mark's code into a single Ping.pl script. Thank
you Mark.
However, I am having trouble getting sensical data based by IP, instead I am
forced to use alpha names.
Thanks,
B
Can anyone tell me why?
C:\scripts>ping.pl "10.10.100.35"
Latency = 0ms
C:\scripts>ping.pl "prueba"
Latency = 50ms
C:\scripts>ping.pl "rotrial1"
Latency = 60ms
C:\scripts>ping.pl 10.10.100.35
Latency = 0ms
C:\scripts>more ping.pl
use Net::Ping;
use Time::HiRes qw( usleep gettimeofday tv_interval );
$host=shift(@ARGV);
main();
sub main
{
#print "host $host";
ping ($host);
}
sub ping
{ my $host = shift(@_);
#print "host $host";
$p = Net::Ping->new("icmp");
for ( $r=0; $r<2; $r++){
$t0 = [gettimeofday];
$IsReachble = $p->ping($host,2);
$t1 = [gettimeofday];
last if $IsReachble;
}
my $delay_ms = sprintf ("%dms",1000* tv_interval ($t0, $t1));
$p->close();
if ($isReachable) {print "Latency = $delay_ms \n";}
print "Latency = $delay_ms \n";
}
-----Original Message-----
From: Mark Zvolanek [mailto:[EMAIL PROTECTED]]
Sent: Sunday, February 10, 2002 3:46 PM
To: '[EMAIL PROTECTED]'
Cc: '[EMAIL PROTECTED]'
Subject: Re: Latency testing
Hi,
I use Time::Hires module to get the latency of ping.
use Net::Ping;
use Time::HiRes qw( usleep gettimeofday tv_interval );
...
$p = Net::Ping->new("icmp");
for ( $r=0; $r<2; $r++){
$t0 = [gettimeofday];
$IsReachble = $p->ping($host,2);
$t1 = [gettimeofday];
last if $IsReachble;
}
my $delay_ms = sprintf ("%dms",1000* tv_interval ($t0, $t1));
$p->close();
...
Hope this helps.
Regards
Mark Zvolanek
+612 9227 0479
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs