zhang yi wrote:
> Here I met one problem: I want to modify default TCP connection parameters
> through SOCKET API. say TCP_NODEALY, SO_RCVBUF, SO_SEND_BUF, I searched
> google, there are document explicitly say that default TCP connection
> parameters should be set by setsockopt() before TCP connect() function is
> called. while I search ONNV and other gates, there are codes that set those
> tunable TCP parameter after connect() is called.
>
> Here I got confused at those totally two different explanation. here is my
> question. If I want to set those tunable TCP parameter for TCP connection.
> when setsockopt will take effect? before connect() or after connect()?
It depends on what you mean by "take effect." For example, TCP_NODELAY
affects the TCP sending behavior. So until your app can send something
to the peer (which means that the connection has already been
established, after the non-blocking connect() returns), the option won't
do anything. And this option can be set any time, before or after, a
connection has been established. The sending behavior is affected after
setting it.
The SO_SNDBUF and SO_RCVBUF socket option can also be set any time. But
once a connection has been established, your app can only increase the
SO_RCVBUF value, not decrease it.
--
K. Poon.
[EMAIL PROTECTED]
_______________________________________________
networking-discuss mailing list
[email protected]