Thanks ! I just find your post. You said that you use Buffer.position(start) instead of Buffer.rewind() in your decoder. Apparently you used an old of version at the time of the post. Your code is :

protected boolean doDecode(IoSession session, ByteBuffer in, ProtocolDecoderOutput out) throws Exception
   {
       try
       {
           if (in.remaining() < 4)
           {
               // We didn't receive enough bytes to decode the
               // message length. Cumulate remainder to decode later.
               return false;
           }

           // We can decode the message length
           int msize = in.getInt();
if (in.remaining() < msize)
           {
// We didn't receive enough bytes to decode the message body.
               // Cumulate remainder to decode later.
               in.rewind();
               return false;
           }
   //decode body
}

My code assumes that I don"t have to rewind or position the buffer if I need more data because the buffer counters are not changed when I call remaining(). Am I wrong ? why do you call rewind ?
Here is my code inspired from the sumServer example :

public MessageDecoderResult decode(IoSession session, ByteBuffer in, ProtocolDecoderOutput out)
   {
       // Read the header if not yet read
if (!readHeader)
       {
           readHeader(in); // the attribute lenght will be affected here
           readHeader = true;
       }

       if (in.remaining() < length)
       {
           return MessageDecoderResult.NEED_DATA;
       }
       else
       {
           MyMessage m = decodeBody(session, in);

readHeader = false; // reset readHeader for the next decode if necessary
           if (m != null)
{ return MessageDecoderResult.OK;
           }
           else
           {
               return MessageDecoderResult.NOT_OK;
           }
       }
   }










Luis Neves a écrit :
Nicolas FROMENT wrote:

Thanks for the tip. I use tcpdump and ethereal to sniff the traffic.
I can now say that the problem is on the server side. One more clue. Any specific place to look at ? Decoder ? anywhere else ?
Am I the only one to have this issue ?

I had this issue recently:
<http://thread.gmane.org/gmane.comp.apache.directory.mina.devel/2732/focus=2732>

In my case the problem was in the Decoder.

--
Luis Neves



--
******************************************************************
Nicolas Froment         [EMAIL PROTECTED]
Software Architect

Hi-Stor Technologies        www.histor.fr
23 bd Victor Hugo            Std:    +33 (0) 562 12 14 40 (Voice)
Bâtiment Socrate             Fax:    +33 (0) 562 12 14 49
31770 Colomiers FRANCE

****************************************************************

Reply via email to