Exemple #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);
 }
Exemple #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);
 }
Exemple #3
0
 /// <summary>
 /// 事件方法-客户端连接时调用
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void serverFacade_ConnectHandler_Show(object sender, CommuEventArgs e)
 {
     Log.ConnectionInfo((e.State == 0 ? "接收连接" : "断开连接") + e.Identity + "," + e.Reason);
     //rtbText((e.State == 0 ? "接收连接" : "断开连接") + e.Identity + "," + e.Reason);
 }