Beispiel #1
0
 /// <summary>
 /// 收到发布"客户端连接"事件时的方法
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void _server_ConnHandler(object sender, CommuEventArgs e)
 {
     //接收到新连接
     if (e.State == 0)
     {
         AddCommuClient(e.Client);
     }
     ConnectHandler_Show?.Invoke(sender, e);
 }
Beispiel #2
0
 /// <summary>
 /// 事件方法-断开客户端连接
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void tcpClient_ConnectHandler(object sender, CommuEventArgs e)
 {
     if (e.State == 1)
     {
         //断开连接
         CommuTcpClient commuClient = sender as CommuTcpClient;
         RemoveCommuClient(commuClient.Identity, e.Reason);
     }
     ConnectHandler_Show?.Invoke(sender, e);
 }