Icmp6CreateFile function (icmpapi.h)
The Icmp6CreateFile function opens a handle on which IPv6 ICMP echo requests can be issued.
Syntax
IPHLPAPI_DLL_LINKAGE HANDLE Icmp6CreateFile();
Return value
The Icmp6CreateFile function returns an open handle on success. On failure, the function returns INVALID_HANDLE_VALUE. Call the GetLastError function for extended error information.
Remarks
The Icmp6CreateFile function opens a handle on which IPv6 ICMP echo requests can be issued. The Icmp6SendEcho2 function is used to send the IPv6 ICMP echo requests. The Icmp6ParseReplies function is used to parse the IPv6 ICMP replies. The IcmpCloseHandle function is used to close the ICMP handle opened by the Icmp6CreateFile function.
For IPv4, use the IcmpCreateFile function.
For IPv4, use the IcmpCreateFile, IcmpSendEcho, IcmpSendEcho2, IcmpSendEcho2Ex, and IcmpParseReplies functions.
Note that the include directive for Iphlpapi.h header file must be placed before the Icmpapi.h header file.
Examples
The following example opens a handle on which IPv6 ICMP echo requests can be issued.
#include <windows.h>
#include <stdio.h>
#include <iphlpapi.h>
#include <icmpapi.h>
#pragma comment(lib, "IPHLPAPI.lib")
void main()
{
HANDLE hIcmpFile;
hIcmpFile = Icmp6CreateFile();
if (hIcmpFile == INVALID_HANDLE_VALUE) {
printf("\tUnable to open handle.\n");
printf("Icmp6Createfile returned error: %ld\n", GetLastError() );
}
else
printf("\tHandle created.\n");
}
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows XP [desktop apps | UWP apps] |
Minimum supported server | Windows Server 2003 [desktop apps | UWP apps] |
Target Platform | Windows |
Header | icmpapi.h |
Library | Iphlpapi.lib |
DLL | Iphlpapi.dll |
See also
IcmpSendEcho