Sorry about the mistake I made. But somehow decodable is not very
neccessary. I can do everything in decode. If no enough packets, i just
return NULL and return MessageDecoderResult.NEED_DATA. I guess position
reverting back happenshere. Correct me if i am wrong. Thanks.

2007/3/20, Trustin Lee <[EMAIL PROTECTED]>:

On 3/19/07, mat <[EMAIL PROTECTED]> wrote:
> I followed the Sumup Server example. In decodable, normally check the
body
> len. you don't have to care about the position since in decodable get()
> method is to get the length of the body. The rest of bytebuffer is saved
in
> the instance of the AbstractMessageDecoder. One session is one instance
of
> the AbstractMessageDecoder if you follow the Sumup Server approach.

The buffer position is always reverted back after decodable() is
invoked, but decode() should revert the buffer position by itself.  It
is because decodable() is for peeking incoming data to choose an
appropriate decoder, and decode() is for actual decoding.  If you want
to wait until the whole message is read into the buffer in decode()
implementation, you'd better not to modify the buffer position until
then.

Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Reply via email to