[nycbug-talk] To ping or not to ping, that is the question...
Jay Savage
daggerquill at gmail.com
Tue Jul 11 12:37:29 EDT 2006
On 7/8/06, Isaac Levy <ike at lesmuug.org> wrote:
> Hi Ray,
>
>
> >
> >> Outside the box:
> >> - to my knowledge, (and digging through the man pages), ping does not
> >> have any options which let the utility return some sort of boolean
> >> value for weather or not a packet was returned.
> >
> > It returns 0 if a packet was received and other values otherwise,
> > depending on the operating system. You'll probably want to use the
> > -c flag.
> >
> > -Ray-
>
> Ok- so now here's my new question, how can I get ping to return less
> verbose stuff, a simple integer returned would be way nicer to
> programatically deal with (vs. having to parse the text)- which in
> the context of my app, is all just verbose garbage for me to deal
> with...
>
> Additionally, I'd like to be able to set some kind of response
> timeout, (under 1 second)?
>
> Rocket-
> .ike
Ike,
If you're at all familiar with Perl, the Net::Ping Perl module is the
way to go (http://search.cpan.org/~bbb/Net-Ping-2.31/lib/Net/Ping.pm).
And if you're not familiar with Perl, you should be. ;)
HTH,
-- jay
--------------------------------------------------
This email and attachment(s): [ ] blogable; [ x ] ask first; [ ]
private and confidential
daggerquill [at] gmail [dot] com
http://www.tuaw.com http://www.dpguru.com http://www.engatiki.org
values of β will give rise to dom!
More information about the talk
mailing list