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.
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 ?
serverwhen write message, prepend command info (the length important, really) , send whole thing. having nodelay enabled or not makes no difference.
clienti continuously receive stuff server, right ? have sort of read.
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
Post a Comment