C#socket 心跳检测
while (m_bAccpectWaiting)
{
//心跳检测
try
{
uint dummy = 0;
byte[] inOptionValues = new byte[Marshal.SizeOf(dummy) * 3];
BitConverter.GetBytes((uint)1).CopyTo(inOptionValues, 0);
BitConverter.GetBytes((uint)5000).CopyTo(inOptionValues, Marshal.SizeOf(dummy));
BitConverter.GetBytes((uint)5000).CopyTo(inOptionValues, Marshal.SizeOf(dummy) * 2);
m_StationSocket.IOControl(IOControlCode.KeepAliveValues, inOptionValues, null);
//接收信息
StationReciveMessage(m_StationSocket);
}
catch
{
MessageBox.Show("dd");
}
不管用呀 ,怎么它不发检测呀