0

I'm working on a new TCP socket server and take example of an old code I'd writen few years ago for an UDP socker server. On my previous work, I checked CRC as first action on messageReceived() then handle the message type to fwd it to the good service. As I can receive various sized messages, it's very convenient that IoBuffer size fit to the exact size of the message received. I can always find checksum at the end of the message.

But in my new project, IoBuffer is always 2048o by default. I tried to understand what option I used on the old project until I saw that the behavior is not the same in Mina 2.0.9 than 2.0.4.

I did some tests and saw that :

  • TCP and version 2.0.4 : iobuffer has a fixed size = 2048
  • UDP and version 2.0.4 : iobuffer has message size
  • TCP and version 2.0.9 : iobuffer has a fixed size = 2048
  • UDP and version 2.0.9 : iobuffer has a fixed size = 2048

Log message with my old app with Mina 2.0.4

16:44:31.800 [NioDatagramAcceptor-1] INFO  log1 - RECEIVED: HeapBuffer[pos=0 lim=4 cap=**4**: 61 7A 64 0A]

Same but just change Mina version to 2.0.9

16:47:40.890 [NioDatagramAcceptor-1] INFO  log1 - RECEIVED: HeapBuffer[pos=0 lim=4 cap=**2048**: 61 7A 64 0A]

I can't find information about that in release notes. Do someone know about that ? It should be a good reason to change it. Am I on the wrong way with what I want to do ? I'm pretty sure that the first action should be to check CRC before trying to handle message by type but perhaps it's not the usual pattern.

Bad thing is also if I want to update Mina version of my old app, it can't work anymore...

Hope it's clear.. Thanks for your help.

FabGre
  • 135
  • 1
  • 9

1 Answers1

0

You can define the receive buffer size in DatagramConnector.getSessionConfig().setReceiveBufferSize. Just set it to whatever you want it to be.

Johnny V
  • 795
  • 5
  • 14