Send a TCP or UDP ping : Ping « Network « Perl






Send a TCP or UDP ping

   

#!/usr/bin/perl
use warnings;

use Net::Ping;
$hostname = shift @ARGV;
$p = Net::Ping->new("icmp"); #could be "udp" or "tcp" instead
print "$host is alive.\n" if $p->ping($host);
$p->close();

   
    
    
  








Related examples in the same category

1.Ping a host