Hacker News new | past | comments | ask | show | jobs | submit login
The Story of the Ping Program
162 points by YAYERKA on Jan 9, 2013 | hide | past | favorite | 28 comments



This story was my favorite part:

: : : : :

The best ping story I've ever heard was told to me at a USENIX conference, where a network administrator with an intermittent Ethernet had linked the ping program to his vocoder program, in essence writing:

ping goodhost | sed -e 's/.*/ping/' | vocoder

He wired the vocoder's output into his office stereo and turned up the volume as loud as he could stand. The computer sat there shouting "Ping, ping, ping..." once a second, and he wandered through the building wiggling Ethernet connectors until the sound stopped. And that's how he found the intermittent failure.


:::::

^ I thought you were starting the story with an ipv6 address to ping...!


Reminds me of setting up a dish for DirecTV. Receiver (thru stereo) beeps loudly, frequency changing via signal strength, while someone points it on the roof.


I burst in laughter in the office.


Interesting story, I loved the vocoder idea!

Sadly Mike passed away in 2000:

    Sadly, Mike Muuss was killed in an automobile accident on November 20, 2000.
    His work lives on in testament to his intellect and indomitable spirit
    -- Lee A. Butler


It's interesting that ICMP ECHO_REQUEST and ECHO_REPLY predate the ping program. But indeed they are defined by http://tools.ietf.org/html/rfc792 from Sep 1981. I guess that Unix hosts were already replying to ECHO_REQUESTs even though this isn't prescribed till http://tools.ietf.org/html/rfc1122#page-42 from 1989. But I wonder what was sending ECHO_REQUEST before ping? The only other standard use of these packets I know of today is DHCP servers before handing out a lease to ensure a host isn't already using a given IP.

Phil Dykstra added ICMP Record Route support to PING, but in those early days few routers processed them

It must have been a narrow window in time when routers respected this option. My Internet career goes back to 1995 and I've never known a router to do so.

I was insanely jealous when Van Jacobson of LBL used my kernel ICMP support to write TRACEROUTE, by realizing that he could get ICMP Time-to-Live Exceeded messages when pinging by modulating the IP time to life (TTL) field. I wish I had thought of that! :-)

Asking a candidate to figure out how traceroute works is one of my interview questions, but if the author of ping didn't think of it, maybe I should drop the question. :)

The real traceroute uses UDP datagrams because routers aren't supposed to generate ICMP error messages for ICMP messages.

The Windows version I believe uses ICMP by default, and the Unix version, these days, can be asked to. I had always heard that routers do reply to ICMP, but at a lower priority.


A shell script like the vocoder one in the article, this works:

  ping google.com | while read line; do 
     echo $line | sed -n 's/^.*time=\(.*$\).*$/\1/p' | xargs say
  done
Says the ping time to google out loud on a Mac.


I know Perl is no longer fashionable, but it’s still the simplest way to do this sort of ad hoc processing I think.

  ping google.com | perl -ne '/time=(.*)/ && system("say", $1)'
Of course it’s only a little more awkward in Ruby:

  ping google.com | ruby -ne '$_ =~ /time=(.*)/ && system("say", $1)'
(No criticism is intended of your perfectly fine code. I enjoy comparing different ways to do things like this, and perhaps others do too.)


For the sake of comparison, here's the corresponding Python one-liner:

   ping google.com | python -c 'import os,re,sys; [os.system("say %s" % j[0]) for j in  (re.findall("time=(.*)", i) for i in sys.stdin) if j]'
I'm sure someone can come up with a shorter one-liner, but in general I think Python is simply too verbose for this kind of stuff.


Add a delay so say can keep up:

ping -i 5 8.8.8.8 | perl -ne '/time=(.*)/ && system("say", $1)'


In NodeJS (tested on Mac 10.7)

   ping g.cn | node -e "process.stdin.on('data',function(l){require('child_process').exec('say '+/time=([0-9]*)/g.exec(l+'')[1])}).resume()"


On linux I used espeak. ping google.com | ruby -ne '$_ =~ /time=(.*)/ && system("espeak", "-s 120", $1);'


Nice code, but I think a more robust method would be using the return codes from ping:

    while (true) do ping -c1 -w3 google.com && say "ping" && sleep 3; done


I know HN is not reddit (and the link is relatively old), but check this alternative take on the history of Ping:

http://www.amazon.com/Story-about-Reading-Railroad-Books/dp/...

BTW, someone has to write a long form article or a thesis on the Amazon Customer Reviews scene…


Best part is the source is in a SHAR..

Wow that brought back memories.

I doubt most people here even know what a SHAR is.

The other day in a group of engineers at my work I made a joke about SHAR and NOBODY even knew what a SHAR was.

It's like making a joke at a party that "Dates you".. :)


I had that happen a few years ago. Nobody had heard of uucp either. Someone once asked me what the first browser I ever used was and when I said Lynx, they thought it was fork of Firefox.


lynx, gopher, irc... Now I feel old, despite being only 34...


Interesting read. Was sad to click through to his homepage and find out that he had already passed away in 2000 due to an automobile accident.


I would like to know how they could maintain this webserver all the years... Rock solid :-) "This Web server was one of the first 50 Web servers on the InterNet"


This is pretty hilarious from the amazon review quoted in the article:

But even with these problems, The Story About Ping has earned a place on my bookshelf, right between Stevens' Advanced Programming in the Unix Environment, and my dog-eared copy of Dante's seminal work on MS Windows, Inferno. Who can read that passage on the Windows API ("Obscure, profound it was, and nebulous, So that by fixing on its depths my sight -- Nothing whatever I discerned therein."), without shaking their head with deep understanding. But I digress.


On the latest release of Linux Mint, I did the following (it should also work for Debian, Ubuntu and other Debian-like systems):

  sudo apt-get install espeak
  HOST=127.0.0.1
  ping $HOST | sed -u -e 's/.*/ping/' | espeak -v en
The -u (unbuffered) option to sed was required to get it to work. Apparently, the problem is that Mint's version of sed (GNU sed version 4.2.1) will buffer too aggressively for this usage when the output is not a terminal. It was a little confusing to troubleshoot since the output looked OK without the last pipe, the espeak command seemed to work when you just run it and type stuff in directly, but putting them together yielded silence without the -u switch.


A great snippet posted by the author in the OP.

"The book describes networking in terms even a child could understand, choosing to anthropomorphize the underlying packet structure. The ping packet is described as a duck, who, with other packets (more ducks), spends a certain period of time on the host machine (the wise-eyed boat). At the same time each day (I suspect this is scheduled under cron), the little packets (ducks) exit the host (boat) by way of a bridge (a bridge). From the bridge, the packets travel onto the internet (here embodied by the Yangtze River)."


This seems like a lovely wry way of expressing YAGNI/MVP/shipping:

    If I'd known then that it would be my most famous accomplishment in life, I might have worked on it another day or two and added some more options.


From the home page of the late Michael John Muuss : "Unlike every other document on the Web, this page is in final form and completely finished. grin"


Not entirely sure what the last comment is talking about…


It's a quote from the server's homepage http://ftp.arl.army.mil/


I agree,That is a great story of using ping!


Wonderful. The vocoder idea is fantastic




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: