Ping 0.1.4

Table of Contents

  1. What is ping ?
  2. How to use ping
  3. How does it compares with Microsoft's ping and tracert
  4. Compiling ping
    1. On Windows from the command Line
    2. On Windows from Visual Studio
    3. On Linux using Wine
  5. Possible enhancements
  6. Reporting bugs or enhancement

1. What is ping ?

The purpose of this Ping implementation initially was to demonstrate the use of the Windows ICMP library. While it's still a good example in this regard it is also worth it in itself as a powerful ping utility. It's behavior was closely modeled after that of Linux with some extensions taken from traceroute.

Ping uses the ICMP protocol's mandatory ECHO_REQUEST datagram to elicit an ICMP ECHO_RESPONSE from a host or gateway. ECHO_REQUEST datagrams (``pings'') have an IP and ICMP header, followed by a ``struct timeval'' and then an arbitrary number of ``pad'' bytes used to fill out the packet.

In trace mode Ping will print the route packets take to reach the specified network host. The Internet is a large and complex aggregation of network hardware connected together by gateways. Tracking the route one's packets follow (or finding the miscreant gateway that's discading your packets) can be difficult. In trace mode Ping uses the IP protocol ``time to live'' field and attempts to elicit an ICMP_ TIME_EXCEEDED response from each gateway along the path to some host.

2. How to use ping

Ping is quite versatile so there is not a single way to use it. Though here are some of its uses:

3. How does it compares with Microsoft's ping and tracert

Microsoft's tools implement the source routing an record route options.

With Microsoft's ping you cannot specify the interval between two packets. Also this ping conforms to the Unices ping options so you may feel more comfortable with it.

Microsoft's tracert just sends 3 probes per host. You cannot configure it for more or get more interesting statistics. Also you cannot specify the maximum RTT to use.

Finally both Microsoft tools give you a RTT rounded down to a millisecond. Even worse the RTT can be underevaluated by up to 2 milliseconds. This ping tool can give you, most of the time, a RTT which is accurate to about 10 microseconds.

Everything that ping does not give you, you can implement it. Of course Microsoft's tools don't come with the source :-).

4. Compiling ping

To compile ping you must also get the icmp package. It should be available from the same place as ping i.e. currently only

You will also need Visual C++ 2.0 or higher. Note that with some modifications in the makefile you should be able to compile it with another compiler.

4.1. On Windows from the command Line

Go in the ping directory and just type:

    nmake -f

If the compiler does not find the "ipexport.h" header then specify where you have the icmp headers like in the command below:

    name ICMP_DIR=../icmp_dev-0.1.2 -f

There are options you may add to this command line to customize the result. All options are disabled by default:

and commands

4.2. On Windows from Visual Studio

Open the 'ping.dsw' file and compile. This is a Visual Studio 6 Workspace file but it should work in Visual Studio 5 too.

4.3. On Linux using Wine

Go to the directory where ping is and run the following commands:

When running the configure script you may need to specify where Wine is if it is installed in a non standard location (in your home directory for instance). Do so as follows:

./configure --with-wine=$HOME/wine

Run "./configure help" for more information on configure's other options. The makefile supports the following commands:

5. Possible enhancements

6. Reporting bugs or enhancements

If you want to report a bug or make an enhancement suggestion or want your modifications to be integrated to this package, send a mail to: This page is hosted for free by