[nycbug-talk] To ping or not to ping, that is the question...

Isaac Levy ike at lesmuug.org
Sat Jul 8 07:41:36 EDT 2006


Hi Ray,

On Jul 8, 2006, at 7:31 AM, Ray Lai wrote:

>> Inside the box:
>> - to my knowledge, (and digging through the man pages), ping cannot
>> bind itself to a particular network interface, which is a problem on
>> boxes with multiple interfaces, with IP's all on the same subnet.
>> (ping just finds the first IP route, and pings out on that interface.
>
> NetBSD and OpenBSD's ping allows this with the -I flag.  FreeBSD's
> allows it with the -S flag.

Well I stand corrected, happily :)

>
>> 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






More information about the talk mailing list