Need to return true when the decoding is done. something like this
if(in.prefixedDataAvaliable(4)) // read message type
{
if(in.prefixedDataAvaliable(4)) // read message length
{
if(in.remaining() >= messageLength)
{
// decode
return true;
}
else
{
return false;
}
}
Can you please check this. More details at
http://mina.apache.org/tutorial-on-protocolcodecfilter-for-mina-2x.html
>> Hi. Im using MINA 2.0.4 on windows 7 32-bit. As a decoder im using CPD,
>> running locally.
>> On client side decoder works without issues, it takes care of incomplete
>> message and more than one message in buffer as well. Nothing is blocking.
>> On server side im using same algorithm.
>>
>> if(in.prefixedDataAvaliable(4)) // read message type
>> {
>> if(in.prefixedDataAvaliable(4)) // read message length
>> {
>> if(in.remaining() >= messageLength)
>> {
>> // decode
>> }
>> else
>> {
>> return false;
>> }
>> }
>> else
>> {
>> return false;
>> }
>> }
>> else
>> {
>> return false;
>> }
>>
>> Problem is that some of the messages cant pass first step, it doesnt matter
>> if they are incomplet or overcomplet. They return false. But when i
>> manually trying to get int, value which should be read is correct. Why is
>> that happens ? Why it happens only for coupe of messages ?
>> Encoder sends bytes properly.
>>
--
thanks
ashish
Blog: http://www.ashishpaliwal.com/blog
My Photo Galleries: http://www.pbase.com/ashishpaliwal