After I looked at the sumup server example, I wonder whether it is the
example just for single client session? It seems it doesn't handle the
mult-session case.

I still get confused about how to handle the multi-session decoding. What if
the incoming message was truncated? How can I re-assembly the truncated
message? Should I do something like?

public MessageDecoderResult decode( IoSession session, ByteBuffer in,
ProtocolDecoderOutput out ) throws Exception{

 ByteBuffer savedByteBuffer = session.getAttribute
("SavedTruncatedByteBuffer");

 SavedTruncatedByteBuffer +  in = newByteBuffer

 IF( newByteBuffer.remaining() >= Message.length)
   decode_body
 ELSE
   NEED_DATA
}

But after i read the source code of ProtocolCodecFilter, it seems each
session has its own decoder class. So can I just save the truncated message
in the decoder class?

What is the purpose of CumulativeProtocolDecoder?

Thanks.

Reply via email to