in reply to Re^2: Solution to broken Net::Ping
in thread Solution to broken Net::Ping
You may want to try.
#!/usr/bin/perl -w use strict; use Net::Ping; $| = 1; my @hosts = <DATA>; my @proto = ("tcp", "udp", "icmp", "stream", "syn"); foreach my $pro ( @proto ) { print "\nProtocol $pro \n"; my $p = Net::Ping->new($pro); foreach my $host( @hosts ) { chomp($host); # Specify source interface of pings print "$host is "; print "NOT " unless $p->ping($host, 2); print "reachable.\n"; } $p->close(); } exit; __DATA__ 127.0.0.1 www.perlmonks.com
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Solution to broken Net::Ping
by Anonymous Monk on Dec 16, 2011 at 23:31 UTC | |
Re^4: Solution to broken Net::Ping
by solignis (Initiate) on Dec 17, 2011 at 07:44 UTC |
In Section
Seekers of Perl Wisdom