in reply to Re^3: Multi-threading ping of a list of hosts.....Again!
in thread Multi-threading ping of a list of hosts.....Again!
The outputuse Net::Ping; my @ips; while (<DATA>) { chomp; push (@ips, $_); print "$_\n"; } # fill this array with your ips #my @ips = map { "192.168.1." . $_ } ( 2 .. 254 ); my @ips_up; use constant { TIMEOUT => 500, PORT => 7 }; my $p = Net::Ping->new( "syn", TIMEOUT() / 1000 ); $p->{port_num} = PORT; $p->ping($_) for (@ips); while ( my ( $host, $rtt, $ip ) = $p->ack ) { push @ips_up, $ip; } local $" = "\n"; print @ips_up; __DATA__ 172.24.175.53 172.24.166.15 172.24.184.43 172.24.175.10 172.24.184.46 172.24.175.55 172.24.184.12
C:\Perl>ping_sweep3.pl C:\Perl>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Multi-threading ping of a list of hosts.....Again!
by borisz (Canon) on Sep 23, 2004 at 11:47 UTC |