コード例 #1
0
ファイル: ExchangeServer.cs プロジェクト: zhutoutou/SJH
        /// <summary>
        /// //客户端已连接
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Server_ClientConnected(object sender, ServerClientEventArgs e)
        {
            //try
            //{
            ExchangeServerClient Client = new ExchangeServerClient();

            Client.dtClientConnTime   = DateTime.Now;
            Client.strClientIP        = ((ScsTcpEndPoint)e.Client.RemoteEndPoint).IpAddress;
            Client.strClientPort      = ((ScsTcpEndPoint)e.Client.RemoteEndPoint).TcpPort.ToString();
            Client.intClientID        = e.Client.ClientId;
            Client.Status             = NetStatus.Connected;
            e.Client.MessageReceived += new EventHandler <MessageEventArgs>(Client.MessageReceived);
            OnlineClentsLock.EnterWriteLock();
            try
            {
                OnlineClents.Add(Client);
            }
            finally
            {
                OnlineClentsLock.ExitWriteLock();
            }
            OnServerConnectedClientChanged();
            //}
            //catch (Exception ex)
            //{
            //    throw ex;
            //    //LogHelper.WriteLog("Error Occurred", ex);
            //}
        }
コード例 #2
0
ファイル: ExchangeMsgHandler.cs プロジェクト: zhutoutou/SJH
 public ExchangeMsgHandler(ExchangeServerClient client)
 {
     ServerClient = client;
 }