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 583479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:47:51+00:00 2026-05-13T14:47:51+00:00

I have an class which should send/receive data in packet form. This class contains

  • 0

I have an class which should send/receive data in packet form. This class contains an event handler which runs when new data is available to be read from the physical medium.

In the event handler I read the data from the medium and parse the available data for complete packets. Once a packet is identified an event is raised to pass the new packet to subscribers. The subscribers to this event decide if they want to use the packet or not.

So far so good… Now to my question. While the scenario above works to distribute the incoming data to a multitude of subscribers and place further processing logic further up in the application it leaves me with a problem:

Sometimes the class will receive a data packet which is just a reply (think ACK/FAIL) to another packet which was sent by the class.

How would I implement a method to send something which would wait for such a confirmation while not breaking the aforementioned concept of handling incoming raw data in the event handler?

Some pseudo code to illustrate the problem:

class CommCenter
{
    public event NewPacketAvailable;

    private void _newRawDataAvailable_EventHandler
    {
        // read incoming data from physical medium

        // parse incoming data for packet structure
        // the received packet may either contain a reply to
        // a previously sent message or unrelated

        // if packet found raise NewPacketAvailable event
        // so that subscribers can handle the packet
    }


    public void SendMessage(DataPacket packet, Int32 timeoutInMilliseconds)
    {
        // put message on the physical medium

        // wait for a packet confirming the previously sent packet
        // How would I have to do this??
        // the packet confirmation would arrive in _newRawDataAvailable_EventHandler
    }
}

Maybe has a good idea or even implemented such a logic before. I’m a bit confused at the moment what to do. Glad for any help or pointers in the right direction 😉

  • 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-13T14:47:51+00:00Added an answer on May 13, 2026 at 2:47 pm

    Okay, this is how it works:

    In the event handler, read the data from the medium. Check if it’s data or just a confirmation of a previous packet (ACK).

    If it is data, pass it on.

    If it is ACK, put it into a special Queue for ACKs.

    In the SendMessage method iterate over this ACK Queue after sending your message until:

    1. Timeout occurs
    2. The confirmation for your sent packet arrives

    That’s it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

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.