Internet Control Message Protocol

ICMP is a network layer protocol that delivers flow control, error messages, routing, and other data between Internet hosts. ICMP is primarily used by application developers for a network ping, which is also known as Packet Internet Groper. A ping is the process of sending an echo message to an IP address and reading the reply to verify a connection between TCP/IP hosts.

Use the following Winsock API functions to write a ping application: IcmpCreateFile, IcmpSendEcho, and IcmpCloseHandle.

    To send an ICMP request or determine if a host is available

  1. Call IcmpCreateFile to create a handle to issue requests.
  2. Call IcmpSendEcho to send an ICMP echo request.

    It returns any ICMP response from the intended host recipient, or returns an error if the network is inaccessible. A time-out value may be specified to limit the wait time in case the destination is inaccessible.

  3. Call IcmpCloseHandle to close the handle created by IcmpCreateFile.