On 6/24/10 5:08 PM, Emmanuel Lécharny wrote:
Forwarded to the correct ML.
Please be careful when replying...
On Thu, 24 Jun 2010 13:55:57 +0200, Emmanuel Lecharny
<[email protected]>
wrote:
I
set the buffer size to 1, so that the data transfer from client to
server
should be horrible slow. But it isn't. So the change I made on buffer
size
is not passed to the socket, but only to the session config object.
I have done the very same test, and I guarantee you that the buffer
size
is set to 1. Here is the modified code that demonstrates the set
value :
Ah, now I see. The classes are more nested than I thought. Thanks for the
stacktrace. That brought up some light ;-)
So to get it clear: If I now wish to change the buffer's size, I have to
do it on server side BEFORE i call "bind()" on the acceptor, correct?
100% correct.
If it's afterwards not possible to change the buffer size, should't there
be at least a note in the javadoc, or the better an exception?
In fact, it's already documented in the Java api :
http://java.sun.com/j2se/1.4.2/docs/api/java/net/Socket.html#setReceiveBufferSize%28int%29
" The value of SO_RCVBUF is also used to set the TCP receive window that
is advertized to the remote peer. Generally, the window size can be
modified at any time when a socket is connected. However, if a receive
window larger than 64K is required then this must be requested *before*
the socket is connected to the remote peer. There are two cases to be
aware of:
1. For sockets accepted from a ServerSocket, this must be done by
calling |ServerSocket.setReceiveBufferSize(int)|
<http://java.sun.com/j2se/1.4.2/docs/api/java/net/ServerSocket.html#setReceiveBufferSize%28int%29>
before the ServerSocket is bound to a local address.
2. For client sockets, setReceiveBufferSize() must be called before
connecting the socket to its remote peer."
--
Regards,
Cordialement,
Emmanuel Lécharny
www.nextury.com