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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:31:01+00:00 2026-06-10T02:31:01+00:00

I have a C++ application with GUI that runs (on PC 1) just like

  • 0

I have a C++ application with GUI that runs (on PC 1) just like a network game, and receives data packets from another computer (2) via WiFi (ad-hoc, so it’s quite reliable) at fairly regular intervals (like 40ms), once per loop on program (2). I use send/read.

Here is the problem:
– Packets are not always fully sent (but apparently you can simply keep send()ing the remaining data until all is sent, and thats works well)
– More importantly, packets are stacked in the socket during (1)’s loop until the read() occurs, and then there is no way to distinguish packets in the big stream of data, or know if you were already in the middle of a packet.

I tried to fix this with ID headers (you find an ID as first bytes and you know the length of the packet), but I often get lost (unknown ID : we are not at the beginning of the packet) and am forced to ignore all the remaining data.

So my question is:
Why do packets stack? (generally I have 400B of data whereas my packets are <100B long and fps (1) and (2) are not very different)
How can I have a more reliable way to receive actual packets, say, 80% of packets (discarding packet loss, it’s not a question of UDP/TCP)?

Would a separate thread for receiving packets work? (on (1), the server)

How do real-time network games to that (including multiple client management)?

Thanks in advance.

(Sorry I do not have the code here, but I tried to be as clear as I could)

  • 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-06-10T02:31:03+00:00Added an answer on June 10, 2026 at 2:31 am

    Well:

    1) UDP transfers MESSAGES, but is unreliable.

    2) TCP transfers BYTE STREAMS, and is reliable.

    UDP cannot reliably transfer messages. Anything more reliable requires a protocol on top of UDP.

    TCP cannot transfer messages unless they are one byte long. Anything more complex requires a protocol on top of TCP.

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

Sidebar

Related Questions

Suppose I have a GUI-only application that runs on Windows and I'd like to
I have just made my first proper little desktop GUI application that basically wraps
I have a GUI application that process some data, it converts line of text
I have a wxPython GUI application that contains 13 pairs of StaticText controls that
I have a GUI C++ application (Visual Studio 2008) that needs to be converted
I have a Java application that run as a background service, i.e. no GUI.
I have a GUI application which works with point cloud data and a quadtree
I want to create an application that runs on the users computer, a stand-alone
I have an GUI application that takes a while to load all its plugins,
I am making a small C# GUI application that reads table-like (cells, rows, columns)

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.