Hello,

I'm currently developing a UDP server using MINA 2.0.
After having done some tests, I have some question on how MINA handles UDP.

By definition, I think that the maximum size of a UDP datagram
(with headers) is 65536 bytes, if we try to write a bigger message we would have the
following exception: "Throwable java.net.SocketException: Message too long."

Is there any guarantee that MINA won't merge or split a message bigger than this limit into two packet? It's important for me as my protocol does not use a message terminator (line feed or some other "special" character) so I'm using
in.array() on ByteBuffer to get the whole content of my datagram.

Also, apparently if the receive buffer size of DatagramSessionConfig is set lower than the size of the message, the message is truncated. So it means that if I send 1000 bytes (in one packet) with a receive buffer of 500 bytes, only 500 bytes will be sent to my protocol decoder and the remaining 500 bytes will be dropped and not given to my protocol decoder by another call to decode().

And about the reverse, if I have a receive buffer of 1500 bytes, if I send 3 packets of 500 bytes, my protocol decoder decode method will be called three times with an in.array() of 500 bytes?

Can someone confirm this?

Thank you in advance,

Bruno Colin


Reply via email to