How to PING

Introduction

I have often been asked how to replicate the PING command-line utility. I often ignored the request and went on to subject that I was more familiar with. But the question has been increasing in frequency over the last few months. I family sat down and tried to hack something together that could be re-used.

The usefulness of the class is limited. The only use I've been able to ascertain is to determine if a particular server is responding to ICMP requests. So, I don't think I'll be able to talk long about how useful this re-usable code is. What's that? ICMP? You don't know what ICMP is? Ok! I'll fill the article with random gibberish about ICMP and its use on the Internet.

Let's start with the basics. What exactly is a PING? A little known fact is the PING is actually a short-form acronym for Packet Internet (or Inter-Network) Groper. The PING utility is most often used in diagnosing network problems. The utility sends one packet of data to the target host and waits for an identical (or echoed) reply from the host. The idea behind the PING is that responding to one packet of data is generally the lowest common denominator in diagnosing network presence. If the host can reply to one packet, then you can be reassured that the host exist. Imagine the situation where a user is having difficulty navigating the corporate website. The user can determine minimal network presence by trying to PING the website.

The PING utility can generally send more than one request and this can also be used to determine if the network is intermittently dropping packets. Last, the PING utility can also be used to determine if the naming service is properly translating names into IP addresses.

ICMP

Now I'm pretty certain you already knew what the PING utility did. You are more likely interested in finding out the how than the what. Here 'tis in black and white. The PING utility does not use TCP (Transmission Control Protocol) like most other network traffic. Neither does it use UDP (User Datagram Protocol). Rather it uses an often forgotten Internet protocol called ICMP (Internet Control Message Protocol). The intent of ICMP has always been in diagnosing IP-network issues. The entire protocol is a quick low-level access point into the IP-network. If you are familiar with the OSI Reference Model, then skip the next couple of paragraphs.

The OSI Reference Model divides the task of communicating over a network into seven layers, application, presentation, session, transport, network, data-link and physical. The TCP, UDP and ICMP protocol are transport layers, whereas the IP protocol is network layer. Much of the IP traffic these days is TCP, a connection-oriented transport layer for the Internet. The TCP connection-oriented protocol provides a lot of services not provided by the IP layer, like ports, checksums, framing and sequencing packets. The UDP connectionless protocol on the other hand does not provide framing or sequencing of packets, but does provide minimal services like ports and checksums. ICMP is yet another step down from UDP and provides only a checksum service. ICMP is really a higher-level tap into the low-level IP-network.

You might also like...

Comments

About the author

Randy Charles Morin

Randy Charles Morin Canada

Randy's article are Copyright 1998-2003 Randy Charles Morin

Interested in writing for us? Find out more.

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Some people, when confronted with a problem, think "I know, I’ll use regular expressions." Now they have two problems.” - Jamie Zawinski