Am using a connector actually (but i guess that doesn't matter :) )
when i was debugging i did notice the capacity dropping to 64 bytes.
However, since the time i posted the query i have been constantly tinkering
with the code and luckily with all the inputs i got (and read in the forums)
.. i have managed to use the CumulativeProtocol codec to decode the messages
appropriately.
I would definitely try to reproduce the issue for someone who can fix the
Mina code (if at all it turns out to be an bug :)
Thanks much for the prompt help offered !
Trustin Lee wrote:
>
> Hi,
>
> On 10/12/07, pingvishal <[EMAIL PROTECTED]> wrote:
>>
>> Hi,
>> its for every new message received (ignore my prev mail .. i did some
>> check
>> to post this again) ..
>> however, whats happening is .. the server has dispatched the entire
>> packet
>> and i dont receive it that way .. (the packet sizes are really small ..
>> abt
>> 200 bytes .. and the ByteBuffer capacity goes down to 64 bytes :| )
>>
>> how should i be tackling this ? store all the incoming chunks in my own
>> object (CumulativeProctocolDecoder) or is there a better way ?
>
> I tried to reproduce your problem with the following example without
> success:
>
>
>
> import java.io.OutputStream;
> import java.net.InetSocketAddress;
> import java.net.Socket;
>
> import org.apache.mina.common.ByteBuffer;
> import org.apache.mina.common.IoHandlerAdapter;
> import org.apache.mina.common.IoSession;
> import org.apache.mina.transport.socket.nio.SocketAcceptor;
>
> public class Main {
>
> private static final int SERVER_PORT = 1234;
>
> public static void main(String args[]) throws Exception {
> SocketAcceptor acceptor = new SocketAcceptor();
> acceptor.bind(new InetSocketAddress(SERVER_PORT), new
> IoHandlerAdapter() {
> @Override
> public void messageReceived(IoSession session, Object o) {
> System.out.println(((ByteBuffer) o).capacity());
> }
> });
>
> Socket s = new Socket("localhost", SERVER_PORT);
> OutputStream out = s.getOutputStream();
> for (int i = 0; i < 100; i++) {
> out.write(new byte[200]);
> Thread.sleep(100);
> }
> }
> }
>
>
> As you see, MINA doesn't decrease the read buffer size to under 256.
> Please feel free to modify the example code above to reproduce the
> problem.
>
> HTH,
> Trustin
> --
> what we call human nature is actually human habit
> --
> http://gleamynode.net/
> --
> PGP Key ID: 0x0255ECA6
>
>
--
View this message in context:
http://www.nabble.com/ByteBuffer-capacity-shrinks-tf4612562s16868.html#a13208541
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.