Hi all, I have to measure the ping reply time for several ip addresses. The problem is, I don't want to wait for the reply of the ping to ip1 and send then the ping to ip2. Both pings should go out almost in parallel on the line. Furthermore ip1 & ip2 should be pinged more than one time e.g. 5 times. I have solution which works with AS perl 5.8 & WinXP (see below).
My question is now: Is this approach completly naiv or are there better ways to do this. I mean first tests showed plausible results (checked with external equipment), but I don't have a feeling how this script will perform if I have to test more than one ip address and if the results are then still correct. Has anyone experiences to share? Thank you in advance. Ciao Eckart #### begin use threads; use strict; use Net::Ping; my ($ping1, $ping2); my $cnt ; while ($cnt++ < 5 ) { $ping1 = threads->new(\&pn, "192.168.2.60"); $ping2 = threads->new(\&pn, "192.168.2.1" ); } $ping1->join; $ping2->join; sub pn { my ($host)[EMAIL PROTECTED]; my $ret; my $dur; my $ip; my $p = Net::Ping->new("icmp"); $p->hires(); ($ret, $dur, $ip) = $p->ping($host,1); if ($ret) { printf("$host is alive (packet return time: %.2f ms)\n", 1000 * $dur); } else { print "host $host is not reachable.\n"; } undef($p); } #### end _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs