private void HeartAsync() { TaskHelper.LongRunning(() => { try { while (!_isClosed) { if (_clientSocket != null && _clientSocket.Connected) { if (Actived.AddMilliseconds(HeartSpan) <= DateTimeHelper.Now) { _clientSocket.Send(_queueCoder.Ping(_name)); } autoResetEvent.WaitOne(HeartSpan / 2); } else { autoResetEvent.WaitOne(1000); } } } catch { } }); }
private void HeartAsync() { ThreadHelper.Run(() => { try { while (!_isClosed) { if (this.Connected) { if (Actived.AddMilliseconds(HeartSpan) <= DateTimeHelper.Now) { SendAsync(_queueCoder.Ping(_name)); } autoResetEvent.WaitOne(HeartSpan / 2); } else { autoResetEvent.WaitOne(1000); } } } catch { } }, true, System.Threading.ThreadPriority.Highest); }
private void HeartAsync() { TaskHelper.Start(() => { try { while (!_isClosed) { if (this.Connected) { if (Actived.AddMilliseconds(HeartSpan) <= DateTimeHelper.Now) { SendAsync(_queueCoder.Ping(_name)); } autoResetEvent.WaitOne(HeartSpan / 2); } else { autoResetEvent.WaitOne(1000); } } } catch { } }); }