Hello,
We are currently developing a client / server application with MINA, and
using the datagram connector. We are having an exception in the following
code:
codec = new ObjectCodec();
connector = new NioDatagramConnector();
connector.setHandler(this);
IoSessionConfig confg = connector.getSessionConfig();
confg.setMaxReadBufferSize(40000);
confg.setMinReadBufferSize(1000);
// confg.setReadBufferSize(80000);
Now the problem is that when the client receives information larger than the
initial minimum buffer size (e.g. 2000 bytes) , it prints out a buffer size
exception (see below). Looks like MINA is not obeying the max buffer size
setting? If we manually set the min read buffer size to 3000 (anything
greater than the data being received from the server), it resolves the
issue. I would have thought that the buffers would be auto adjusted due to
the max buffer size settings? Is there any way to resolve this issue aside
from setting the minbuffer size to a ridiculous size ?
java.io.IOException: A message sent on a datagram socket was larger than the
internal message buffer or some other network limit, or the buffer used to
receive a datagram into was smaller than the datagram itself
at sun.nio.ch.DatagramDispatcher.read0(Native Method)
at sun.nio.ch.DatagramDispatcher.read(DatagramDispatcher.java:25)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:233)
at sun.nio.ch.IOUtil.read(IOUtil.java:206)
at sun.nio.ch.DatagramChannelImpl.read(DatagramChannelImpl.java:324)
at
org.apache.mina.transport.socket.nio.NioProcessor.read(NioProcessor.java:180)
at
org.apache.mina.transport.socket.nio.NioProcessor.read(NioProcessor.java:42)
at
org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:575)
at
org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:547)
at
org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:539)
at
org.apache.mina.core.polling.AbstractPollingIoProcessor.access$400(AbstractPollingIoProcessor.java:57)
at
org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:867)
at
org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:65)
Session closed...
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Thanks