You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Sungwon Jung <th...@gmail.com> on 2007/09/03 02:39:48 UTC

stack packet message (ByteBuffer?)

Hello. I'm develop server with MINA 1.1.1.

1) client send packet to server.
message is FF 00 00 01 10 00 00 00 00 00 00
2) server received packet.
FF 00 00 01 10 00 00 00 00 00 00

it's right.

but,
3) and then client send other packet to server
message is FF 00 00 01 20 00 00 00 00 00 00
4) server received packet
FF 00 00 01 10 00 00 00 00 00 00 FF 00 00 01 20 00 00 00 00 00 00

it's wrong. server should receive only FF 00 00 01 20 00 00 00 00 00 00.
server received [before before packet][before packet].... packet is increase.

I don't know you understood.
it's too difficult in English.

how can I solve this problem?

Re: stack packet message (ByteBuffer?)

Posted by Trustin Lee <tr...@gmail.com>.
On 9/3/07, Sungwon Jung <th...@gmail.com> wrote:
> thank you!
> I'm using CumulativeProtocolDecoder. sorry.
> but I don't want cumulative packet.
>
> do I make un-cumulative protocol decoder? or is there un-cumulative
> protocol decoder in mina?

Well, you have to use cumulative protocol decoder if you are on
TCP/IP.  You just need to move the buffer position properly so
CumulativeProtocolDecoder notice up to where you read the packet.

In an ordinary situation, you will consume the buffer up to the end of
the message, but it seems like you are doing something different.  You
have to set the current position of the buffer to the end of the
message so that CumulativeProtocolDecoder can discard decoded part.

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

Re: stack packet message (ByteBuffer?)

Posted by Sungwon Jung <th...@gmail.com>.
thank you!
I'm using CumulativeProtocolDecoder. sorry.
but I don't want cumulative packet.

do I make un-cumulative protocol decoder? or is there un-cumulative
protocol decoder in mina?


On 9/3/07, Trustin Lee <tr...@gmail.com> wrote:
> Hi Sungwon,
>
> On 9/3/07, Sungwon Jung <th...@gmail.com> wrote:
> > Hello. I'm develop server with MINA 1.1.1.
> >
> > 1) client send packet to server.
> > message is FF 00 00 01 10 00 00 00 00 00 00
> > 2) server received packet.
> > FF 00 00 01 10 00 00 00 00 00 00
> >
> > it's right.
> >
> > but,
> > 3) and then client send other packet to server
> > message is FF 00 00 01 20 00 00 00 00 00 00
> > 4) server received packet
> > FF 00 00 01 10 00 00 00 00 00 00 FF 00 00 01 20 00 00 00 00 00 00
> >
> > it's wrong. server should receive only FF 00 00 01 20 00 00 00 00 00 00.
> > server received [before before packet][before packet].... packet is increase.
>
> Are you using CumulativeProtocolDecoder or something similar?  If so,
> you might not have changed the buffer position after decoding a
> message.
>
> HTH,
> Trustin
> --
> what we call human nature is actually human habit
> --
> http://gleamynode.net/
> --
> PGP Key ID: 0x0255ECA6

Re: stack packet message (ByteBuffer?)

Posted by Trustin Lee <tr...@gmail.com>.
Hi Sungwon,

On 9/3/07, Sungwon Jung <th...@gmail.com> wrote:
> Hello. I'm develop server with MINA 1.1.1.
>
> 1) client send packet to server.
> message is FF 00 00 01 10 00 00 00 00 00 00
> 2) server received packet.
> FF 00 00 01 10 00 00 00 00 00 00
>
> it's right.
>
> but,
> 3) and then client send other packet to server
> message is FF 00 00 01 20 00 00 00 00 00 00
> 4) server received packet
> FF 00 00 01 10 00 00 00 00 00 00 FF 00 00 01 20 00 00 00 00 00 00
>
> it's wrong. server should receive only FF 00 00 01 20 00 00 00 00 00 00.
> server received [before before packet][before packet].... packet is increase.

Are you using CumulativeProtocolDecoder or something similar?  If so,
you might not have changed the buffer position after decoding a
message.

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