If the function succeeds, the return value is the number of
replies received from the remote host. If the function fails, the
return value is ICMP_ERROR. To get extended error information, call
IcmpGetLastError.
The IcmpEcho function sends a series of ICMP echo datagrams
to the specified host, providing a simplified interface for pinging a
remote system. If the function returns the same value as the number
of iterations, then replies were received for all of the echo
datagrams that were sent. This would typically indicate that the
client can establish a reliable connection to the server; the values
returned in the ICMPTIME structure provide information on the latency
between the two hosts. Higher average time values would indicate
greater latency and reduced throughput between the systems. If the
function returns a value less than the specified number of
iterations, this indicates that replies were not received for one or
more of the echo datagrams. This may indicate that there are problems
routing data between the local and remote host. A return value of
zero indicates that there was no response to the echo datagrams. The
remote host may not exist or may not be available.
The failure for a host to respond to an ICMP echo datagram may not
indicate a problem with the remote system. In some cases, a router
between the local and remote host may be malfunctioning or discarding
the datagrams. Systems can also be configured to specifically ignore
ICMP echo datagrams and not respond to them; this is often a security
measure to prevent certain kinds of Denial of Service attacks.
The ability to send ICMP datagrams may be restricted to users with
administrative privileges, depending on the policies and configuration
of the local system. If you are unable to send or receive any ICMP
datagrams, it is recommended that you check the firewall settings and
any third-party security software that could impact the normal
operation of this component.