Ejemplo n.º 1
0
 /// <summary>
 /// Timer类执行定时到点事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void TimerUp(object sender, System.Timers.ElapsedEventArgs e)
 {
     ttl -= (int)((System.Timers.Timer)(sender)).Interval;
     if (ttl <= 0)
     {
         IsActive = false;
         HandleNodeClosed?.Invoke(this);
         timer.Dispose();
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 关闭指定客户端连接
 /// </summary>
 /// <param name="theConnection">指定的客户端连接</param>
 public void CloseNode(NODE node)
 {
     RemoveNode(node);
     //调用外部回调函数通知连接被关闭
     HandleNodeClosed?.Invoke(this, node);
 }