Fix: #293 Wrong keep-alive time set for IOCPServer

This commit is contained in:
yuanyuanxiang
2026-01-27 19:58:20 +01:00
parent d49c541ea2
commit e40cb4da92
5 changed files with 48 additions and 3 deletions

View File

@@ -700,7 +700,7 @@ void IOCPServer::OnAccept()
//设置套接字的选项卡 Set KeepAlive 开启保活机制 SO_KEEPALIVE
//保持连接检测对方主机是否崩溃如果2小时内在此套接口的任一方向都没
//有数据交换TCP就自动给对方 发一个保持存活
m_ulKeepLiveTime = 3;
m_ulKeepLiveTime = 1000 * 60 * 3;
const BOOL bKeepAlive = TRUE;
setsockopt(ContextObject->sClientSocket,SOL_SOCKET,SO_KEEPALIVE,(char*)&bKeepAlive,sizeof(bKeepAlive));