/// <summary> /// socket回调 /// </summary> /// <param name="state"></param> private static void SocketTimerCallBack(object state) { lock (locker) { if (isRunning) { return; } isRunning = true; } try { if (!SocketClientProxy.IsConnected) { NLogHelper.Warn("重启socket客户端"); SocketClientProxy.Start(); } } catch (Exception ex) { NLogHelper.Error("socket监控定时器异常:" + ex); } finally { lock (locker) { isRunning = false; } } }
/// <summary> /// 关闭定时器 /// </summary> public static void Stop() { if (socketTimer != null) { try { socketTimer.Dispose(); } catch { } socketTimer = null; } //关闭 发送 接收 多线程 SocketClientProxy.IsRunning = false; SocketClientProxy.Stop(); }