You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Bogdan Jarcau <dr...@gmail.com> on 2007/02/08 17:10:38 UTC

Recovering information from ByteBuffer once a session is closed

Hi all,

I am working on a protocol (TCP) that utilizes messages separated by an End
Of Message character (in this case \n). I use the decodable() method to
check if the message is complete and once it detects an EOM character it
will return true, decode() is called, and the messsage will be extracted
from the ByteBuffer. Now, assuming that I receive a message and the
connection dies out before it receives the EOM character, how could I
retrieve/salvage the data that still exists in the ByteBuffer? I could
technically store the data locally in a variable, but is there a better way
to access that data?
I am using Mina 1.01, and am using MessageDecoderAdapter.

Thank you,

Bogdan

Re: Recovering information from ByteBuffer once a session is closed

Posted by Trustin Lee <tr...@gmail.com>.
Sorry for too late response. :)

On 2/9/07, Bogdan Jarcau <dr...@gmail.com> wrote:
> Hi all,
>
> I am working on a protocol (TCP) that utilizes messages separated by an End
> Of Message character (in this case \n). I use the decodable() method to
> check if the message is complete and once it detects an EOM character it
> will return true, decode() is called, and the messsage will be extracted
> from the ByteBuffer. Now, assuming that I receive a message and the
> connection dies out before it receives the EOM character, how could I
> retrieve/salvage the data that still exists in the ByteBuffer? I could
> technically store the data locally in a variable, but is there a better way
> to access that data?
> I am using Mina 1.01, and am using MessageDecoderAdapter.

You can override finishDecode() method.

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