The documentation for Net::Ping doesn't suggest that an IP address string (e.g., '192.168.1.1') has to be converted to a thirty-two bit integer.  Just use the IP address string (or a scalar containing the string):
 
print "Host is alive" if $p->ping('192.168.1.1');
 
Net::Ping doesn't work with the loopback address on my machine, but it does work for a real IP address string.
 
 
Gary
 
 -----Original Message-----
From: Roboz B�la [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 30, 2001 5:00 AM
To: [EMAIL PROTECTED]
Subject: Problem with PING method

Hi All,
 
    Please help me, Why the ping method in the prg. doesn't return a true value? I don't understand it.
 
Thanks: Beci
 

#!/usr/bin/perl -w
use Socket;
use Net::Ping;
 
$iaddr=inet_aton("127.0.0.1"); # or other address
 
$p = Net::Ping->new();
print "Host is alive" if $p->ping($iaddr);
$p->close();
 

Reply via email to