On Thu, 24 Jun 2010 10:25:20 +0200, Emmanuel Lecharny
<[email protected]>
wrote:
>>
>> But this fix isn't complete, or? If I now set the read buffer size with
>> the session config object, it's simply stored in the member variable,
but
>> not passed to the socket.
>>
>
> I checked this point, and I can confirm that the buffer size is
> correctly read and passed to the socket.
>
> So false alarm, pfewww...
But where? I checked out the complete source (1hr ago) and had a look into
org.apache.mina.transport.socket.DefaultSocketSessionConfig
and
org.apache.mina.transport.socket.nio.NioSocketAcceptor
I found no location where the setReceiveBufferSize method was called on
the socket.
Also the current bevahior is a bit strange:
--code--
final NioSocketAcceptor acceptor = new NioSocketAcceptor();
System.out.println("read buffer size =
"+acceptor.getSessionConfig().getReadBufferSize());
System.out.println("send buffer size =
"+acceptor.getSessionConfig().getSendBufferSize());
System.out.println("recv buffer size =
"+acceptor.getSessionConfig().getReceiveBufferSize());
--/code--
This snippet produces the following output:
--output--
read buffer size = 2048
send buffer size = -1
recv buffer size = -1
--/output--
the application then continues with setting up filter chain, setting
handlers etc and finally this line is executed:
--code--
acceptor.bind(new InetSocketAddress(55555));
System.out.println("Listening in port 55555");
System.out.println("recv buffer size =
"+acceptor.getSessionConfig().getReceiveBufferSize());
--/code--
The result:
--output--
Listening in port 55555
recv buffer size = -1
--/output--
So, even if the server is up an running, one cannot read the receive
buffer size.
I tried to set the receive buffer size. To see if this makes a difference,
I set the receive buffer size to 1, which should slow down a data transfer
massively. I added the following snippet just before the bind() call:
--code--
acceptor.getSessionConfig().setReceiveBufferSize(1);
System.out.println("changed recv buffer size =
"+acceptor.getSessionConfig().getReceiveBufferSize());
--/code--
Result: The output shows the buffer size of 1. But the transfer is as fast
as with 8192 ... So I guess my assumption that the buffer value is not
passed to the socket is proven, or?
br,
Alex