b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

tcp长连接测试_tcp连接软件_http长连接(2)

电脑杂谈  发布时间:2017-05-03 23:01:46  来源:网络整理

B、如果我们不想使用这么长的等待时间,可以修改内核关于网络方面的配置参数,也可设置SOCKET的TCP层(SOL_TCP)选项TCP_KEEPIDLE、TCP_KEEPINTVL和TCP_KEEPCNT。

TCP_KEEPIDLE:开始首次KeepAlive探测前的TCP空闭时间

The tcp_keepidle parameter specifies the interval of inactivity that causes TCP to generate a KEEPALIVE transmission for an application that requests them. tcp_keepidle defaults to 14400 (two hours).

TCP_KEEPINTVL:两次KeepAlive探测间的时间间隔

The tcp_keepintvl parameter specifies the interval between the nine retries that are attempted if a KEEPALIVE transmission is not acknowledged. tcp_keepintvl defaults to 150 (75 seconds).

TCP_KEEPCNT:断开前的KeepAlive探测次数

The TCP_KEEPCNT option specifies the maximum number of keepalive probes to be sent. The value of TCP_KEEPCNT is an integer value between 1 and n, where n is the value of the systemwide tcp_keepcnt parameter.

如果心搏函数要维护客户端的存活,即服务器必须每隔一段时间必须向客户段发送一定的数据,那么使用SO_KEEPALIVE是有很大的不足的。因为SO_KEEPALIVE选项指"此套接口的任一方向都没有数据交换"。在Linux 2.6系列上,上面话的理解是只要打开SO_KEEPALIVE选项的套接口端检测到数据发送或者数据接受就认为是数据交换。因此在这种情况下使用SO_KEEPALIVE选项 检测对方是否非正常连接是完全没有作用的,在每隔一段时间发包的情况,keep-alive的包是不可能被发送的。上层程序在非正常断开的情况下是可以正常发送包到缓冲区的。非正常端开的情况是指服务器没有收到"FIN"或者"RST"包。


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/tongxinshuyu/article-45030-2.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    • 吕无野
      吕无野

      #宋茜4walls#

    • 何洋
      何洋

      听说大多都是在威海卫港区里被人家炸成的

    • 刘源
      刘源

      听得我分分钟不想看了

    热点图片
    拼命载入中...