The Story of the Ping Program
ftp.arl.army.mil
ftp.arl.army.mil
: : : : :
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...!
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. ButlerPhil 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.
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. 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.) 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.ping -i 5 8.8.8.8 | perl -ne '/time=(.*)/ && system("say", $1)'
ping g.cn | node -e "process.stdin.on('data',function(l){require('child_process').exec('say '+/time=([0-9]*)/g.exec(l+'')[1])}).resume()" while (true) do ping -c1 -w3 google.com && say "ping" && sleep 3; donehttp://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…
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".. :)
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.
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."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)."
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.