MSDN中TCP keepalive时效的说明以及设置TCP Keepalive的代码

本文介绍了MSDN中关于TCP Keepalive的时效设置,并提供了设置TCP Keepalive的代码示例,包括设置keepalive间隔和超时时间,以及使用setsockopt和WSAIoctl函数进行配置。当检测到连接异常时,会关闭客户端的Socket。
摘要由CSDN通过智能技术生成
说明:
A TCP keep-alive packet is simply an ACK with the sequence number set to one less than the current sequence number for the connection. A host receiving one of these ACKs will respond with an ACK for the current sequence number.
翻译:
一个TCP keep-alive 包是一个简单的ACK,该ACK包内容为 一个比当前连接sequence number 小于一的包。主机接受到这些ACKs会返回一个包含当前sequence number 的ACK包。

说明:
Keep-alives can be used to verify that the computer at the remote end of a connection is still available.
翻译:
Keep-alives一般被用来验证远端连接是否有效。

说明:
TCP keep-alives can be sent once every KeepAliveTime (defaults to 7,200,000 milliseconds or 2 hours), if no other data or higher-level keep-alives have been carried over the TCP connection.
翻译:
如果该连接上没有其他数据被传输,或者更
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值