If the Avengers: Age of Ultron taught us anything, its that sometimes ideas fail spectacularly. Case in point, Ultron wanted to destroy the world to save that. That was a big mistake by Tony Stark, and not just a big mistake, a BIG BIG mistake. On the Internet, sometimes things fail as well, just not as spectacularly as Ultron, but still, a failure. There’s a protocol to tell us that something went wrong, it’s called ICMP. It’s not nearly as dangerous as Ultron trying to make the world explode, and that’s a good thing.
In this post I said there were 65535 ports on a system. What happens if you try to access port 99999? That port doesn’t exist!
The good news is that your computer won’t blow up. That would be a good plot for a movie, don’t you think? Send a connection to a system on a particular port and watch the computer go BOOM. (Hollywood, if you use that, I thought of it first.)
The other good news is that you won’t even notice it when it happen, unless you’re sitting there watching every little bit of traffic coming to your computer (if so you need a new hobby). Your computer silently handles the problem by sending an ICMP packet saying ‘Nope, that’s not here.’
Your computer can also send ICMP packets out. The program ping uses what’s called an ICMP ECHO_REQUEST packet to see if another computer is alive and to find out how long it takes to get there. It runs like:
Alpha:~ computerlamp$ ping www.google.com PING www.google.com (173.194.205.103): 56 data bytes 64 bytes from 173.194.205.103: icmp_seq=0 ttl=45 time=27.505 ms 64 bytes from 173.194.205.103: icmp_seq=1 ttl=45 time=24.952 ms 64 bytes from 173.194.205.103: icmp_seq=2 ttl=45 time=23.545 ms 64 bytes from 173.194.205.103: icmp_seq=3 ttl=45 time=24.521 ms 64 bytes from 173.194.205.103: icmp_seq=4 ttl=45 time=23.499 ms 64 bytes from 173.194.205.103: icmp_seq=5 ttl=45 time=27.609 ms
It keeps going and going and going… until you use Control-C to stop it.
When I do hit control-C, it tells me some statistics about the traffic:
--- www.google.com ping statistics --- 6 packets transmitted, 6 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 23.499/25.272/27.609/1.695 ms
Or, I can use the -c flag for ping. That way it will only do the number of pings I tell it to:
Alpha:~ computerlamp$ ping www.google.com PING www.google.com (173.194.205.103): 56 data bytes 64 bytes from 173.194.205.103: icmp_seq=0 ttl=45 time=24.166 ms 64 bytes from 173.194.205.103: icmp_seq=1 ttl=45 time=23.373 ms 64 bytes from 173.194.205.103: icmp_seq=2 ttl=45 time=23.462 ms 64 bytes from 173.194.205.103: icmp_seq=3 ttl=45 time=23.437 ms 64 bytes from 173.194.205.103: icmp_seq=4 ttl=45 time=23.783 ms --- www.google.com ping statistics --- 5 packets transmitted, 5 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 23.373/23.644/24.166/0.297 ms