Here's how I usually use it:

###################################

use strict;
use Net::Ping;
my $p = Net::Ping->new('icmp',2);

my @servers = @ARGV;

foreach(@servers){
  if($p->ping($_)){
    print "$_ answered.\n";
  }else{
    print "$_ timed out.\n";
  }
}

###################################

-----Original Message-----
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 6/6/02 6:17 AM
Subject: Net::Ping....(Help!!)

Hi All,
 
I'm just newbie in using Perl,i tried to use Net-Ping module.
i download (ActivePerl-5.6.1.632-MSWin32-x86.msi) on my Windows 2000
server.
and get use PPM to istall Net-Ping package.
 
Put when i tried that sample code 
 
 
use Net::Ping;
 
/////////////////////////////////



    $p = Net::Ping->new();

    print "$host is alive.\n" if $p->ping($host);

    $p->close();




    $p = Net::Ping->new("icmp");

    foreach $host (@host_array)

    {

        print "$host is ";

        print "NOT " unless $p->ping($host, 2);

        print "reachable.\n";

        sleep(1);

    }

    $p->close();

    

    $p = Net::Ping->new("tcp", 2);

    while ($stop_time > time())

    {

        print "$host not reachable ", scalar(localtime()), "\n"

            unless $p->ping($host);

        sleep(300);

    }

    undef($p);

    

    # For backward compatibility

    print "$host is alive.\n" if pingecho($host);


////////////////////////
and use $host='127.0.0.1';
 
I doesn't get any output at all.
 
i want to know how to use the moudules ,in the Perl .
can any one help me.
 
i will be thatnks for Help.
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to