David Rosenstrauch wrote:
Emmanuel Lecharny wrote:
I would add a forth case :
* more than one complete message in a single buffer.

In this case, you have to loop until you have decoded all the messages, calling the next filter for each decoded message.

This is what we do in Apache Directory to decode LDAP requests.

Hmmm ... I might not actually be handling this case. I'll have to check my code.

Thanks much for the heads up.

DR

Question:

So say in my decoder I do as follows:

public class BinaryProtocolDecoder extends CumulativeProtocolDecoder {
protected boolean doDecode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) {
...
                MyMessage msg = decodeOneMessage(in);
                return true;
        }
}


i.e., I decode one message from out of the buffer, and leave any remaining bytes that are part of the next message left unread in the buffer.

Are those remaining bytes from the next message lost? And if they're not lost, will the CumulativeProtocolDecoder then immediately call my doDecode method again to try to decode that message?

DR

Reply via email to