At 03:28 PM 2/26/02 +0000, Lanceo wrote:
>Thanks Peter, that worked great!
>
>If you use http:// in the host address the server cannot be found, though...

Then it's no longer a host name, is it?

>"Peter Scott" <[EMAIL PROTECTED]> wrote in message
>[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > At 09:19 AM 2/22/02 +0000, Lanceo wrote:
> > >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);
> >
> > I've seen this sooo many times.  The answer: www.google.com responds to
> > ICMP ping packets (which are what the ping program sends) but has chosen
> > (or some router in between has chosen) not to respond to TCP ping packets
> > (which are what Net::Ping sends).  Don't need to be on DOS to find this
> > out, here's Linux:
> >
> > $ ping www.google.com
> > PING www.google.com (216.239.51.100) from 24.67.203.181 : 56(84) bytes of
>data.
> > 64 bytes from www.google.com (216.239.51.100): icmp_seq=0 ttl=52
>time=119.7 ms
> > 64 bytes from www.google.com (216.239.51.100): icmp_seq=1 ttl=52
>time=116.1 ms
> > ^C
> > $ perl -MNet::Ping -le 'print "#5 is alive" if
> > Net::Ping->new->ping("www.google.com")'
> > $
> >
> > Okay, so let's use ICMP packets.  On Unix, we have to be root:
> >
> > $ su
> > Password:
> > # perl -MNet::Ping -le 'print "#5 is alive" if
> > Net::Ping->new("icmp")->ping("www.google.com")'
> > #5 is alive
> >
> > But on DOS, you don't ("security?  what's that"):
> >
> > C:\WINDOWS\Desktop>perl -MNet::Ping -le "print qq(#5 is alive) if
> > Net::Ping->new(qq(icmp))->ping(qq(www.google.com))"
> > #5 is alive

--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to