On 6/24/10 5:27 PM, Alexander Christian wrote:
On Thu, 24 Jun 2010 17:22:48 +0200, Emmanuel Lecharny
<[email protected]>
wrote:
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.
fine.

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."
I read this too. But didn't you say that it's not possible to change the
buffer size after the server is connected? According to this javadoc, the
socket's (client+server) allows this (at least for sizes<=64k).

Yes, for a size < 64k.



--
Regards,
Cordialement,
Emmanuel Lécharny
www.nextury.com


Reply via email to