On 10/13/11 6:58 AM, Vishal Gupta wrote:
====================
Scenraio:
====================
- A server is sending data to the MINA server which has implemented
"CumulativeProtocolDecoder"
- Server is sending x bytes
- While getting data first thread is getting data from position m instead of
position 0
In the decoder ? If the data has just been received, then the data
should be at position 0. If it's not the case, then somewhere in your
code, you are reading the IoBuffer, moving the position.
- Second thread picks the data from 0 to m
Probably because the first buffer has been fully read.
- Either of the thread doesn't get the complete data and that's why protocol
decoding is failed
Without the complete decoder code, it's hard to tell what's going wrong.
In any case, there is something wrong in your code.
- Data is coming correctly to the socket as confirmed by "tcpdump logs"
- Something which is I am doing wrong or has to be taken care of? How do I
guarantee the only one thread picks up the data and in right order??
It's guaranteed. The thing is that you have to take care of split
messages ( it can be received in many parts, thus the use of the
CumulativeProtocolDecoder). OTOH, you have to b careful in the way you
handle the parts, to form a complete message. Again, the ecoder code is
necessary.
- Sorry for being little verbose, but thought it might help to give max info
in problem statement
No, this is perfect.
--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com