Exemple #1
0
 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 { }
     });
 }
Exemple #2
0
 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);
 }
Exemple #3
0
 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 { }
     });
 }