[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ping



bouchalhi youness wrote:
> i'm a perl debutante.i want know how can i make a ping command from a
> web using perl or javascript.


i had the same question yesterday.

here's how it works from perl...

Net::Ping is the answer (how to ping from perl)
but it's got a snag in it, apparently.

"man Net::Ping" yields:
           use Net::Ping;

           $p = Net::Ping->new();
           print "$host is alive.\n" if $p->ping($host);
           $p->close();

but it doesn't work like that right out of the box.

you hafta
           $p = Net::Ping->new("icmp");
instead, and then it works. (udp, which is the default,
and tcp, both have internal problems at least for perl 5.005.)

if you don't have it, you get it (under debian's linux)
with "apt-get install perl-5.005" (if your /etc/apt/sources.list
is set up the way you want it), i think.  :)


Reply to: