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