in reply to Net::Ping with threads

Here is a script that can scan around 200 hosts in 5 secs. Without threads.
#!/usr/bin/perl use Net::Ping; my @host_array = ( '1.2.3.4', ... ); my @up; $" = "\n"; my $p = Net::Ping->new( "syn", 5 ); $p->{port_num} = 7; $p->ping($_) for (@host_array); while ( my ( $host, $rtt, $ip ) = $p->ack ) { push @up, $ip; } print @up;
Boris
Boris

Replies are listed 'Best First'.
Re^2: Net::Ping with threads
by Spesh00 (Initiate) on Mar 15, 2005 at 19:50 UTC
    On activestate perl 5.8.4 on XP this doesn't return anything it seems. I did entertain syn based scanning however part of the requirements is that it also be ICMP if needed, which while being faster then straight TCP, doesn't allow the "fire and forget" nature of SYN... On the HPUX env I tried this on it wanted ICMP as well as SYN wasn't apparently supported. Excellent suggestion though, thanks, I'm seeing if I can't get it working on another env.
    I guess I should mention that this is for a windows network - running from another windows server. Developement is coming from my XP box.
    Anyone else?