Netty beginner question

47 views
Skip to first unread message

goodnews...@gmail.com

unread,
Jul 25, 2016, 4:00:06 PM7/25/16
to Netty discussions
Hello,

I find when I do several write and flush operation back to back from a netty server, they all come as one packet to my AIR client.
Is there any way to force packets to come as seperate packets instead of jamming together into one big packet that doesn't involve waiting milliseconds?

,James

goodnews...@gmail.com

unread,
Jul 25, 2016, 6:39:57 PM7/25/16
to Netty discussions

Background: I'm toying with making a multiplayer game. I already have registration and login working.

I just found that if I send several .writes at the same time, they come as a single packet on receive instead of multiple packets.

I know a couple ways to resolve this, but I was just wondering if there is some way to seperate the packets aside from time delaying them.

Rogan Dawes

unread,
Jul 26, 2016, 2:20:41 AM7/26/16
to Netty discussions
Use writeAndFlush() to send the packet immediately.

--
You received this message because you are subscribed to the Google Groups "Netty discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netty+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netty/4c6546ea-5e73-4b63-ba01-c9292d34e542%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alexander Lehmann

unread,
Jul 28, 2016, 10:02:01 AM7/28/16
to Netty discussions, goodnews...@gmail.com
I assume the network stack will decide how to put the packets together, which means that there may be packages that are split into parts if they are too long or are put together into a big packet (at least with tcp) so you cannot rely on either

If you use some kind of framing or use a separation byte to make sure you can reconstruct the packages if they are changed, that would be safe in all cases, e.g. prefix each packet with a size byte or word (depending on how large your packets can be).

James Sager

unread,
Aug 1, 2016, 9:34:56 PM8/1/16
to Alexander Lehmann, Netty discussions
Thanks, I figured as much.  Right now, I'm being lazy and delaying 250ms for a prototype, but I can fix it later
Reply all
Reply to author
Forward
0 new messages