David Rosenstrauch wrote:
Emmanuel Lecharny wrote:
Be aware that you not only can receive a fragment, but may be -
depending on your protocol - more than one message in the same PDU
(ie you may receive 200 bytes, 2 times 78 bytes plus some more bytes
associated with another message). You have to deal with that.
If the protocol is a text based one, you may have a look to the
documentation :
http://mina.apache.org/handling-packet-fragementation.html
The tutorial explain how to handle fragmented messages, using a class
extending the CumulativeProtocolDecoder class.
Hope it helps...
Sorry, getting a little confused about one aspect of this though:
I was under the impression that if I'm using TextLineCodecFactory that
it takes care of all the message fragmentation work for me, and that
my handler's messageReceived method is guaranteed to be passed one and
only one text line per method call. And so consequently, you really
only need to deal with fragmentation if you're not using
TextLineCodecFactory. Have I got that correct?
Yeah, you're right, if the message is a text based one. But if it's a
binary protocol, then you can't use the TextLineCodecFactory, obviously.
--
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org