断电那种网络也有消息?
项目中关于网络编程部分。
同事说断电那种也会响应网络关闭事件?
还说TCP有自己的心跳包?
由于代码封装等原因,没能查看和测试,问下各位大虾?
真的能实现无论任何情况下都能响应网络关闭事件的代码?
TCP有自己的心跳包?
[解决办法]
问你同事,这个还真没有听说过,应该是没有
[解决办法]
struct TTCP_KeepAlive
{
::u_long onoff;
::u_long keepalivetime;
::u_long keepAliveInterval;
};
TTCP_KeepAlive *TCP_KeepAlive;
TCP_KeepAlive=new TTCP_KeepAlive[1];
TCP_KeepAlive->onoff=1;
TCP_KeepAlive->keepalivetime=1000;
TCP_KeepAlive->keepAliveInterval=1000;
DWord Ret;
WSAIoctl(AContext->Connection->Socket->Binding->Handle,IOC_IN
[解决办法]
IOC_VENDOR
[解决办法]
4,&TCP_KeepAlive,sizeof(*TCP_KeepAlive),NULL,0,&Ret,NULL,NULL);