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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:49:26+00:00 2026-05-23T13:49:26+00:00

so I have this real-time game, with a C++ sever with disabled nagle using

  • 0

so I have this real-time game, with a C++ sever with disabled nagle using SFML library , and client using asyncsocket, also disables nagle. I’m sending 30 packets every 1 second. There is no problem sending from the client to the server, but when sending from the server to the clients, some of the packets are migrating. For example, if I’m sending “a” and “b” in completly different packets, the client reads it as “ab”. It’s happens just once a time, but it makes a real problem in the game.

So what should I do? How can I solve that? Maybe it’s something in the server? Maybe OS settings?

To be clear: I AM NOT using nagle but I still have this problem. I disabled in both client and server.

  • 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-23T13:49:26+00:00Added an answer on May 23, 2026 at 1:49 pm

    You have to disable Nagle in both peers. You might want to find a different protocol that’s record-based such as SCTP.

    EDIT2

    Since you are asking for a protocol here’s how I would do it:

    • Define a header for the message. Let’s say I would pick a 32 bits header.

      Header:
          MSG Length: 16b
          Version: 8b
          Type: 8b
      
    • Then the real message comes in, having MSG Length bytes.

    So now that I have a format, how would I handle things ?

    Server

    When I write a message, I prepend the control information (the length is the most important, really) and send the whole thing. Having NODELAY enabled or not makes no difference.

    Client

    I continuously receive stuff from the server, right ? So I have to do some sort of read.

    • Read bytes from the server. Any amount can arrive. Keep reading until you’ve got at least 4 bytes.
    • Once you have these 4 bytes, interpret them as the header and extract the MSG Length
    • Keep reading until you’ve got at least MSG Length bytes. Now you’ve got your message and can process it

    This works regardless of TCP options (such as NODELAY), MTU restrictions, etc.

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

Sidebar

Related Questions

I'm working on a simple 2D Real time strategy game using XNA. Right now
I have this code (which is way simplified from the real code): public interface
REAL newbie here to Objective C and Cocoa. I have this 'if statement' if
Okay this is a real headscratcher. I have an application which calls a web
This is a real newbie question. I have simple app that selects a picture
This is a simplified task which I have to solve in real project. In
I'm new to jQuery so this may be a real simple answer. I have
I'm interested in putting together my first online game using Flash as the client
im trying to make a real time strategy game such as starcraft or age
I'm working on a real-time space strategy game clone which at its time did

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.