tcp - Nagle-Like Problem -



tcp - Nagle-Like Problem -

so have real-time game, c++ sever disabled nagle using sfml library , , client using asyncsocket, disables nagle. i'm sending 30 packets every 1 second. there no problem sending client server, when sending server clients, of packets migrating. example, if i'm sending "a" , "b" in completly different packets, client reads "ab". it's happens 1 time time, makes real problem in game.

so should do? how can solve that? maybe it's in server? maybe os settings?

to clear: not using nagle still have problem. disabled in both client , server.

you have disable nagle in both peers. might want find different protocol that's record-based such sctp.

edit2

since asking protocol here's how it:

define header message. let's pick 32 bits header.

header: msg length: 16b version: 8b type: 8b

then real message comes in, having msg length bytes.

so have format, how handle things ?

server

when write message, prepend command info (the length important, really) , send whole thing. having nodelay enabled or not makes no difference.

client

i continuously receive stuff server, right ? have sort of read.

read bytes server. amount can arrive. maintain reading until you've got @ to the lowest degree 4 bytes. once have these 4 bytes, interpret them header , extract msg length keep reading until you've got @ to the lowest degree msg length bytes. you've got message , can process it

this works regardless of tcp options (such nodelay), mtu restrictions, etc.

tcp network-programming real-time asyncsocket sfml

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -