Hi
If you are looking to find out is a host is alive try this bit of code.
$host = www.google.com;
$ip=join ".",unpack("C4",(gethostbyname($host))[4]);
$ip will be empty if host is dead
from command line
perl -e "print join \".\",unpack(\"C4\",(gethostbyname(@ARGV[0]))[4]);"
www.google.com
hope this helps
Regards
Mark
----- Original Message -----
From: "Tanton Gibbs" <[EMAIL PROTECTED]>
To: "Lanceo" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, February 22, 2002 10:27 AM
Subject: Re: ping
The problem is that your web page needs to be specified as
http://www.google.com You left off the http://
However, when I tried to run this using activestate 5.6.1.631 on Windows 98,
I got an error saying that alarm was Unimplemented. I had to change to udp
to get rid of that error. Does anyone know why alarm is unimplemented in my
version? Also, what can I do to add it?
Thanks!
Tanton
----- Original Message -----
From: "Lanceo" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 22, 2002 4:19 AM
Subject: ping
> Hi,
>
> I am having difficulty getting the Net::Ping module to work properly. I
am
> using ActivePerl 5.6.1.631 on a win32 platform. I can ping a server in a
> dos prompt ok, but when I try to get the Perl Net::Ping to work it always
> returns a failure. It seems to ponder over pinging the host for a couple
of
> seconds, and then return a zero as a result, which means that it could not
> reach the host, if my interpretation of the docs is correct.
>
> Here is the snippet in question:
>
> my ($pingThing, $host, $pingResult);
> $host = 'www.google.com';
> $pingThing = Net::Ping->new("tcp", 1);
> $pingResult = $pingThing->ping($host);
>
> print "$pingResult\n";
> if($pingResult == 1){print "$host is alive.\n";}
> else{print "$host could not be pinged\n";}
>
> $pingThing->close();
>
> Am I doing something wrong here, or do I need some other module that I am
> unaware of? I find this sort of bizarre, as I have LWP doing a successful
> page fetch, so the module can obviously access the web.
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.325 / Virus Database: 182 - Release Date: 2/20/02
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]