110,501
社区成员
发帖
与我相关
我的任务
分享
int keepAlive = -1744830460; // SIO_KEEPALIVE_VALS
byte[] inValue = new byte[] { 1, 0, 0, 0, 0x20, 0x4e, 0, 0, 0xd0, 0x07, 0, 0 }; // True, 20 秒, 2 秒
sct = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
sct.IOControl(keepAlive, inValue, null);
通过IOControl设置是否需要发送心跳,以及心跳的频率