in reply to Re^2: Multi-threading ping of a list of hosts.....Again!
in thread Multi-threading ping of a list of hosts.....Again!
use Net::Ping; # fill this array with your ips my @ips = map { "192.168.1." . $_ } ( 2 .. 254 ); my @ips_up; use constant { TIMEOUT => 5000, 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;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Multi-threading ping of a list of hosts.....Again!
by BrowserUk (Patriarch) on Sep 20, 2004 at 22:46 UTC | |
|
Re^4: Multi-threading ping of a list of hosts.....Again!
by blackadder (Hermit) on Sep 23, 2004 at 11:36 UTC | |
by borisz (Canon) on Sep 23, 2004 at 11:47 UTC |