Which timeout value determins how long will the idle TCP connection will be closed?
After the connection has been established, and the two sides have no communication, which timeout value determines the idle connection be close开发者_高级运维d?
In general, none. It is the programmer's and protocol-designer's responsibility to specify, implement and enforce any timeouts at an application level.
However, all kinds of things can happen to cause outages and other network connectivity issues. It is not possible to determine if a TCP connection is idle, or if the other end is unreachable, unless you're trying to send something.
For this reason, most servers with long-standing connections contain simple polls such as sending empty packets or such every so-often just to detect lack of connectivity.
精彩评论