On Tue, 22 Jun 2010 11:36:07 +0200, Alexander Christian <[email protected]>
wrote:
>
> ----
> try {
> // This is a non blocking socket channel
> channel.configureBlocking(false);
>
> // Configure the server socket,
> ServerSocket socket = channel.socket();
>
> // Set the reuseAddress flag accordingly with the setting
> socket.setReuseAddress(isReuseAddress());
>
> // XXX: Do we need to provide this property? (I think we
need
> to remove it.)
>
> socket.setReceiveBufferSize(getSessionConfig().getReceiveBufferSize());
>
> // and bind.
> socket.bind(localAddress, getBacklog());
>
> // Register the channel within the selector for ACCEPT event
> channel.register(selector, SelectionKey.OP_ACCEPT);
> success = true;
> }
> ----
>
> The comment already has some doubt if this is correct or not. I'm
> currently analyzing what would be the default value before setting the
mina
> default...
>
I figured it out by running the following test class:
---
import java.io.IOException;
import java.net.ServerSocket;
import java.nio.channels.ServerSocketChannel;
public class Test {
public static void main(String[] args) throws IOException {
ServerSocketChannel channel = ServerSocketChannel.open();
channel.configureBlocking(false);
ServerSocket socket = channel.socket();
System.out.println(socket.getReceiveBufferSize());
}
}
---
The output on my Win7 64 bit + Sun JDK 6 Update 10 32bit is:
8192
So the system would start with sufficient buffer size of 8192, but MINA
reset's it to MINAs default, which is 1024.
I think it does not make sense to overwrite by default the systems default
values with own values, that in turn might cause problems.
Wouldn't it be better if MINA starts with system defaults (provided by
OS?) and if the user asks for the current set buffer sizes, the socket is
asked for the current sizes?
br,
Alex