IcmpSendEcho

The IcmpSendEcho function sends an ICMP echo request, and returns one or more replies.

Syntax

DWORD WINAPI IcmpSendEcho (HANDLE IcmpHandle IPAddr DestinationAddress LPVOID RequestData WORD RequestSize PIP_OPTION_INFORMATION RequestOptions LPVOID ReplyBuffer DWORD    ReplySize DWORD Timeout);

At a Glance

Header file: Icmpapi.h
Platforms: H/PC
Versions: 2.0 and later

Parameters

IcmpHandle
An ICMP handle opened by IcmpCreateFile.
DestinationAddress
The destination of the echo request.
RequestData
A buffer containing the data to be sent in the request.
RequestSize
The number of bytes in the RequestData buffer.
RequestOptions
Pointer to the IP header options for the request. May be NULL.
ReplyBuffer
A buffer to hold any replies to the request. When the function returns, the buffer will contain one or more ICMP_ECHO_REPLY structures, followed by options and data.
ReplySize
The size in bytes of the reply buffer. The buffer must be large enough to accommodate at least one ICMP_ECHO_REPLY structure plus eight additional bytes (the size of an ICMP error message).
Timeout
The time in milliseconds to wait for replies.

Return Values

Returns the number of replies received and stored in the reply buffer. Returns zero if unsuccessful. Extended error information is available through GetLastError.

See Also

ICMPCreateFile, GetLastError