Exemple #1
0
 /// <summary>
 /// 连接事件处理器
 /// </summary>
 /// <param name="session"></param>
 private void SocketServer_NewSessionConnected(AppSession session)
 {
     ClientsIPEndPoint.Add(session.RemoteEndPoint);
     LogHelper.Logger.Info($"SocketServer_NewSessionConnected,SessionID:{session.SessionID}");
     OnSessionConnected?.Invoke(this, new ConnectEventArgs(session.RemoteEndPoint));
 }
Exemple #2
0
 /// <summary>
 /// 关闭事件处理器
 /// </summary>
 /// <param name="session"></param>
 /// <param name="closeReason"></param>
 private void SocketServer_SessionClosed(AppSession session, SuperSocket.SocketBase.CloseReason closeReason)
 {
     ClientsIPEndPoint.Remove(session.RemoteEndPoint);
     LogHelper.Logger.Info($"SocketServer_SessionClosed,SessionID:{session.SessionID} CloseReason:{closeReason}");
     OnSessionClosed?.Invoke(this, new ClosedEventArgs(session.RemoteEndPoint, (CloseReason)(int)closeReason));
 }