Title: Message
This works for me on Win2000 when using "icmp" or "udp".
 
use Net::Ping;
$host = "MySrvr";
# $p = Net::Ping->new("tcp");
$p = Net::Ping->new("icmp");
# $p = Net::Ping->new();
print "$host is: "; 
if ($p->ping($host)) {
   print "alive.\n" ;
}
else {
   print "unreachable.\n" ;
}
$p->close();
 
 
This works with udp (default) and "icmp".  For some I can't get "tcp" to work.  With "tcp", I get a message: "The Unsupported function alarm function is unimplemented at C:/Perl/lib/Net/Ping.pm line 308".

 
 
 

Kirk W. Batzer
[EMAIL PROTECTED]

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of James H. Cutts III
Sent: Tuesday, May 29, 2001 1:18 PM
To: [EMAIL PROTECTED]
Subject: Using Net::Ping

I am having difficulty in using Net::Ping.

The code:
use Net::Ping;
$p = Net::Ping->new();
$host = "aspn.activestate.com";
print "$host is ";
print "NOT " if (! $p->ping($host) );
print "alive\n";

$host = "199.60.48.99";
print "$host is ";
print "NOT " if (! $p->ping($host) );
print "alive\n";

$p->close();



Running this code on Win NT and Win 95 returns the same result:
        aspn.activestate.com is NOT alive
        199.60.48.99 is NOT alive

However, at the same time I am able to do a command line PING to both addresses and get a valid return.  I've tried it with numerous different hosts, including pinging my own workstation.  I never get a live host response.

I've gotten Net::LDAP  to work so I know that I've got my network connection working.

Any suggestions on what might be done to get it working.  Ping seems to be the simplest to get going so I'm surprised that I'm having difficulty with it.

Thanks.
--------------------------------------------------------------------------------------------------------
James H. Cutts III                                      ITS - RES
Computer Project Manager                                University of Missouri - Columbia
                                                                                401 Clark Hall
                                                                                Columbia, MO 65211-4405

E-mail: [EMAIL PROTECTED]

Reply via email to