Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6891845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:27:40+00:00 2026-05-27T06:27:40+00:00

I am using IcmpSendEcho2 to send an ICMP echo request to a host I

  • 0

I am using IcmpSendEcho2 to send an ICMP echo request to a host I would like to check. However, I need to handle the response asynchronously in a separate receiver thread.

In order to accomplish that, I create a new Windows event handle (CreateEvent) for every request I send out. The receiving thread will be notified and waits for incoming replies using WaitForMultipleObjects.

This event notification system works fine, but I cannot get IcmpSendEcho2 to be invoked asynchronously. The MSDN says that

The IcmpSendEcho2 function is called asynchronously when either the ApcRoutine or Event parameters are specified.

I do specify the Event parameter, but the calling thread is still locked until either a response arrived or the Timeout time has passed. I would expect that the method returns immediately and the supplied event gets signaled as soon as a response arrives or the timeout time has passed. At least that’s my understanding of “asynchronous”.

This is my invocation of the function, the parameters provided are valid:

dwResult = IcmpSendEcho2(
    icmpFileHandle,
    eventHandle,
    NULL, //no apcRoutine   
    NULL, //no apcContext
    ((sockaddr_in*)addrInfo->ai_addr)->sin_addr.S_un.S_addr,
    &requestData,
    sizeof(requestData),
    &requestOptions,
    &icmp4ReplyBuffer,
    sizeof(icmp4ReplyBuffer),
    30000);

Does the MSDN have a different understanding of “asynchronous”, or is there anything I am doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:27:41+00:00Added an answer on May 27, 2026 at 6:27 am

    According to the official documentation:

    The IcmpSendEcho2 function sends an IPv4 ICMP echo request and returns
    either immediately (if Event or ApcRoutine is non-NULL) or returns
    after the specified time-out. The ReplyBuffer contains the ICMP echo
    responses, if any.

    Your understanding of asynchronous is correct, and it should return immediately if you passed a non-NULL event.

    If it isn’t working as expected, there are 3 possibilities:

    1. Your eventHandle is NULL, meaning the CreateEvent failed and returned a NULL handle. Have you checked?
    2. You’re closing the ICMP file handle (IcmpCloseHandle) right after the asynchronous IcmpSendEcho call (suggested by OP in comments).
    3. If you’re running a firewall application, it could be hooking that API and unintentionally breaking the asynchronous requirement.
    4. You could have found a Windows bug.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Rails 3.2.0 with haml and sass: I Would like to link an external
Using C#, I need a class called User that has a username, password, active
Using preview 4 of ASP.NET MVC Code like: <%= Html.CheckBox( myCheckBox, Click Here, True,
Using the RichTextArea in GWT, It looks like I can only change the font
Using gcc and ld on x86_64 linux I need to link against a newer
using VB.Net2010 I need to call a C# DLL The problem I have is
using a binary search tree I need to add to a vector all int
using SQL Server 2005 standard edition with SP2 I need to design a table
Using VBScript, I want to add an additional button to Notepad labeled send .
Using online interfaces to a version control system is a nice way to have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.