# The philosophy of failed pings

**URL:** <https://www.ruby-forum.com/t/the-philosophy-of-failed-pings/89051>\
**Category:** Ruby\
**Created:** [March 16, 2007, 7:26pm UTC](https://www.ruby-forum.com/t/the-philosophy-of-failed-pings/89051 "2007-03-16T19:26:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [March 16, 2007, 7:26pm UTC](https://www.ruby-forum.com/t/the-philosophy-of-failed-pings/89051/1 "2007-03-16T19:26:09Z")

</div>

Hi all,

I need some advice. I recently received a bug report for  
Net::Ping::External class (part of  
the net-ping package) where the user was getting false positives.

In his case he was pinging some bogus loopback address. The ping  
command did not raise any error or warning, but it did have 100%  
packet failure.

So, my question is, should I look for “100% packet loss” in the output  
and, if found, consider that a failed ping no matter what? I know I  
could make it configurable, but even if I go that route, I’d like to  
know what the default behavior should be.

It wouldn’t be hard to implement, but I thought I would ask since I  
think this package is fairly popular now I think and I want to get  
feedback before I start breaking things.

Thanks,

Dan

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [March 16, 2007, 8:00pm UTC](https://www.ruby-forum.com/t/the-philosophy-of-failed-pings/89051/2 "2007-03-16T20:00:13Z")

</div>

100% loss sounds like an absolute failure to me, at least with a vanilla  
“Is  
it up?” situation.

On 3/16/07, Daniel B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Dan

–  
“Hey brother christian with your high and mighty errand, Your actions  
speak  
so loud, I can’t hear a word you’re saying.”

-Greg Graffin (Bad Religion)

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [March 17, 2007, 12:18am UTC](https://www.ruby-forum.com/t/the-philosophy-of-failed-pings/89051/3 "2007-03-17T00:18:04Z")

</div>

On 3/16/07, Daniel B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> So, my question is, should I look for “100% packet loss” in the output  
> Dan

Normally I try to look it up myself, but right now I am a little bit  
tired, sorry and man ping does not show the return values on my  
Zenwalk ☹

I feel that you should go for maximum compatibility with the ping  
system command.  
So whenever ping leaves $? to 0 return true, else false.

The question remains: Which system? well I would opt for Linux b/c it  
is probably the same as \*BSD. But it is your project 🙂

> 

Just my 0.02…

Robert

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [March 17, 2007, 1:06am UTC](https://www.ruby-forum.com/t/the-philosophy-of-failed-pings/89051/4 "2007-03-17T01:06:07Z")

</div>

On Mar 16, 2007, at 2:25 PM, Daniel B. wrote:

> I need some advice. I recently received a bug report for  
> Net::Ping::External class (part of  
> the net-ping package) where the user was getting false positives.
> 
> In his case he was pinging some bogus loopback address. The ping  
> command did not raise any error or warning, but it did have 100%  
> packet failure.

I’m not sure I understand. Net::Ping::External#ping(host) was  
returning true even though there was 100% packet loss to the host?

I don’t think #ping(host) should return true unless there has  
actually been a packet returned from the targeted host.

Not sure if that answers your question though.

Gary W.

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [March 17, 2007, 1:02pm UTC](https://www.ruby-forum.com/t/the-philosophy-of-failed-pings/89051/5 "2007-03-17T13:02:54Z")

</div>

On 3/17/07, Daniel B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Yeah, the more I think about it, the more I’m leaning in that  
> direction.

This is probably silly, but ping isn’t that hard. Couldn’t you just  
implement it with a raw socket? (Or supply both flavors, the ICMP and  
the  
UDP.) Then you’d have complete control over the outcome.

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [March 31, 2007, 10:18pm UTC](https://www.ruby-forum.com/t/the-philosophy-of-failed-pings/89051/6 "2007-03-31T22:18:21Z")

</div>

On Mar 17, 6:01 am, “Francis C.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > > actually been a packet returned from the targeted host.
> 
> > > Not sure if that answers your question though.
> 
> > Yeah, the more I think about it, the more I’m leaning in that  
> > direction.
> 
> This is probably silly, but ping isn’t that hard. Couldn’t you just  
> implement it with a raw socket? (Or supply both flavors, the ICMP and the  
> UDP.) Then you’d have complete control over the outcome.

The net-ping package includes ICMP and UDP implementations (among  
others). This is strictly for external pings that I’m referring to.

Anyway, I’m going to update it and put out a release sometime this  
weekend hopefully. I need to get a Rakefile added as well.

Regards,

Dan

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [March 17, 2007, 6:06am UTC](https://www.ruby-forum.com/t/the-philosophy-of-failed-pings/89051/7 "2007-03-17T06:06:28Z")

</div>

On Mar 16, 6:05 pm, Gary W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I’m not sure I understand. Net::Ping::External#ping(host) was  
> returning true even though there was 100% packet loss to the host?

Yes. In all of my past experiences when that happened there would be  
some additional output sent to stderr, or something sent to stdout  
that warned you something was wrong, and so my code relied on that. In  
this particular case there was no warning or error.

> I don’t think #ping(host) should return true unless there has  
> actually been a packet returned from the targeted host.
> 
> Not sure if that answers your question though.

Yeah, the more I think about it, the more I’m leaning in that  
direction.

Regards,

Dan
