directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sander Aiaots <aia...@gmail.com>
Subject [mina] ByteBuffer and MessageDecoder/MessageEncoders
Date Mon, 30 May 2005 14:42:02 GMT
Hi,

I have a question about MessageDecoder/MessageEncoder, 
For example I create client, what is associated with MessageEncodert
that transforms String into bytes and one other Object also into
bytes.
So I send these two objects away: sess.write(myobject);//22 bytes
sess.write("12345342711"); //11 bytes
But MessageDecoder decode is called once with ByteBuffer containing 33
bytes of data?
Why isn't decode called twice with 22 bytes of data, and then 11?
Or sometimes, I saw that, decode is called twice, but both times It
contains 33 bytes of data.
Or am I misunderstood, that TCP actually is like stream, so I must
build mechanism how-to separate messages? Or is there some kind
implementations exist in MINA already?

On decode I read bytes out: byte[] buf = new byte[in.remaining()];
in.get(buf, in.position(), in.remaining()); So why I am getting this
ByteBuffer twice with same data?

Hopefully my question was understandable.
Best regards,
Sander Aiaots

Mime
View raw message