/// <summary> 心跳包\在线客户端线程 /// </summary> public static void _HeartBeatThread() { while (true) { if (LoginFlag) { int minute = DateTime.Now.Minute; if (minute % 5 == 0 && (minute > 4 || minute == 0)) { //服务站在线状态 ContolHandler.UpLoadServerStatus(); DateTime currentTime = GlobalStaticObj_Server.Instance.CurrentDateTime; foreach (string dbName in _dbList) { //在线用户 ContolHandler.UpLoadOnline(dbName, GlobalStaticObj_Server.Instance.UserUploadTime.ToString()); } //备份上传时间 GlobalStaticObj_Server.Instance.LastUploadTime = currentTime.Ticks.ToString(); //写入 ConfigManager.SaveConfig(ConfigConst.UserUploadTime, GlobalStaticObj_Server.Instance.UserUploadTime, ConfigConst.ConfigPath); } HeartBeatHandler.SendHeartBeat(); } //心跳包间隔 Thread.Sleep(waitSecond * 1000); } }
/// <summary> 心跳包\在线客户端线程 /// </summary> public static void _HeartBeatThread() { try { var min = 0; while (true) { if (LoginFlag) { int minute = DateTime.Now.Minute; if (minute % 5 == 0 && (minute > 4 || minute == 0)) { FactoryHandler.HandleLocalFacData(); //服务站在线状态 ContolHandler.UpLoadServerStatus(); DateTime currentTime = GlobalStaticObj_Server.Instance.CurrentDateTime; foreach (string dbName in _dbList) { //在线用户 ContolHandler.UpLoadOnline(dbName, GlobalStaticObj_Server.Instance.UserUploadTime.ToString()); } //备份上传时间 GlobalStaticObj_Server.Instance.LastUploadTime = currentTime.Ticks.ToString(); //写入 ConfigManager.SaveConfig(ConfigConst.UserUploadTime, GlobalStaticObj_Server.Instance.UserUploadTime, ConfigConst.ConfigPath); } //if (min != minute) //{ HeartBeatHandler.SendHeartBeat(); min = minute; //} } //心跳包间隔 Thread.Sleep(waitSecond * 1000); } } catch (Exception ex) { GlobalStaticObj_Server.CloudPadLogService.WriteLog("云平台", ex); } }