移除DeviceManager.cs中错误的心跳机制实现
This commit is contained in:
@@ -1222,21 +1222,6 @@ namespace JoyD.Windows.CS.Toprie
|
||||
if (DateTime.Now - lastConnectionCheckTime > TimeSpan.FromSeconds(30))
|
||||
{
|
||||
Log("定期检查温度数据连接状态");
|
||||
// 尝试发送一个简单的心跳消息到TCP连接
|
||||
try
|
||||
{
|
||||
if (localStream != null && localStream.CanWrite)
|
||||
{
|
||||
byte[] heartbeat = Encoding.ASCII.GetBytes("heartbeat\r\n");
|
||||
localStream.Write(heartbeat, 0, heartbeat.Length);
|
||||
localStream.Flush();
|
||||
Log("温度数据连接心跳发送成功");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"温度数据连接心跳发送失败: {ex.Message},可能需要重新连接");
|
||||
}
|
||||
lastConnectionCheckTime = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user