keepalive

本文介绍了TCP/IP套接字中KeepAlive的功能及工作原理。当连接的两端没有数据交换时,KeepAlive可以周期性地发送探测包来检测连接状态。若另一端未响应,则认为连接已断开,并将错误信息发送给控制进程。默认情况下,该功能处于禁用状态。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

{keepalive, Boolean}(TCP/IP sockets)

Enables/disables periodic transmission on a connected socket, when no other data is being exchanged. If the other end does not respond, the connection is considered broken and an error message will be sent to the controlling process. Default disabled.

 

在keepalive的设置时间范围之内,出现网络异常,如客户端把掉网线,这时服务器是无法检测到的。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值