>客户端计算机上的应用程序(Firebird DB客户端)在端口3050上打开与服务器的TCP连接
>应用程序崩溃客户端,应用程序终止
>服务器上的netstat仍显示端口3050上的TCP连接ESTABLISHED到客户端IP地址.
>关闭客户端
>服务器上的netstat仍显示端口3050上的TCP连接ESTABLISHED到客户端IP地址.
>等了好几分钟
>服务器上的netstat仍显示端口3050上的TCP连接ESTABLISHED到客户端IP地址.
Windows下已建立的连接是否超时(在本例中为Win8.1)?
我可以更改此超时吗?
我找到了this,但这似乎没有回答我建立连接的问题.
应用程序可以使用TCP keepalive机制来检查断开的连接. In Firebird (>1.5) TCP keepalives are enabled.
必须在服务器上设置keepalive“超时”. Windows is 2 hours (but recommended are 5 minutes)中的默认TCP keepalive时间间隔.
它可以在HKLM\System\CurrentControlSet\Services\Tcpip\Parameters\KeepAliveTime
注册表项中设置.
以上链接的更多细节:
a Failed client connection will be closed after the following time interval:
KEEPALIVE_TIME+ ( KEEPALIVE_PROBES+1)* KEEPALIVE_INTERVAL
在Windows中具有以下相应的注册表值:
KEEPALIVE_TIME = KeepAliveTime (default: 7200 seconds) KEEPALIVE_INTERVAL = KeepAliveInterval (default: 1 second) KEEPALIVE_PROBES = TCPMaxDataRetransmissions (default: 5)
但:
A keepalive segment is sent every two hours by default […]. Even if enabled,other upper-layer protocols such as NetBIOS send their own keepalive value. If the keepalive interval that the upper-layer protocol uses is less than the TCP keepalive interval,TCP keepalive value is never sent. For example,NetBIOS sessions over TCP/IP send a NetBIOS keepalive request every 60 minutes. Therefore,TCP keepalive values that are enabled for a NetBIOS session are never used.