Tuesday, May 30, 2006

Ruby has a ping in the Standard Library, but it's not a very good one. I really think it should be replaced, and there are a couple of options. Let me tell you what's wrong with the current ping. Then I'll lay out a plan for replacing it.

First, it's in the wrong place. Instead of being nestled in with net/http, net/smtp, and the rest of the net friends, ping is off in its own little world. This could be fixed if it weren't for a bigger problem.

Second, ping isn't even an implementation of the real (ICMP) ping. It only does TCP pings (by default on the echo port). And it's not called in a standard way. The documents recommend the following:

There are timeout and service parameter, but no number of ping attempts and you only get back a boolean value.

We can do better than that. In fact, we already have. There are at least three implementations of ping floating around that could be merged to provide a sensible interface; the full range of TCP, UDP, and ICMP pings; and could live happily in net/ping. Is that too much to ask?

UPDATE: I wrote this on Friday, intending to post it this morning. In the meantime, Peter Szinek posted a message to ruby-talk asking if there were any way to get ping stats from Ruby. This is exactly the kind of functionality that we need to include in netping. I guess I was being more timely than I thought.

So did anything happen with this? Is your code anywhere available? Did you add the ability to do a continuous ping and get the stats of the roundtrip times for each itteration (that is what I'm looking for)