Wednesday, October 28, 2009

Ping!

Pinging is the act of sending ICMP packets to another device, and waiting for a response. It's a good way of seeing if we're online, or if the hopeful recipient is online. It is prevalent enough that it's become slang for contacting someone, to see if they're around and listening. And it's gone beyond that; I just realized that Google Wave's use of "Pinging" someone makes it official in a way.

But even in the ICMP packet sense, it was in a sense a slang usage. From Wikipedia:

"Mike Muuss wrote the program in December, 1983, as a tool to troubleshoot odd behavior on an IP network. He named it after the pulses of sound made by a sonar, since its operation is analogous to active sonar in submarines, in which an operator issues a pulse of sound at the target, which then bounces from the target and is received by the operator. (The pulse of sound in sonar is analogous to a network packet in ping)."

Here's the other half of the story. I always feel inclined to theme my computer. Really put some life into it. I thought of a really silly idea, and a great way how to do this today while sitting at the Skylark.

So here's where it all comes together: Noisy Ping (for lack of better name)

When you set this up, ping will emit a sonar sound. And if you get a response, you will hear a subdued version of the same sound.

Code licensed under WTFPL, sound was from a creative commons site, so it's under Sampling Plus 1.0. Don't sue me if a whale tries to mate with your computer. Or if my program does something bad (though I promise I didn't mean to do anything bad, and that I'm running this on my own computer).

This was sortof hacked together, because frankly I have better things to do than to do this "properly", but I did my best to make sure that the python script relayed ping's inputs and outputs and kill signals faithfully (though I have a failsafe SIGTERM, followed by SIGKILL, at the end). if you have any suggestions on how to make this more safe, less crash prone, more portable, etc, please feel free to send me a better version.

And hell, it's sortof useful too. If you're pinging something and you don't want to watch the terminal to see if you get anything back.

So there you go.