Esempio n. 1
0
 /// <summary>
 /// 收集監視器數據之在線數統計-增加
 /// </summary>
 /// <param name="Role"></param>
 public static void OnlineStatAdd(User.UserRole Role)
 {
     switch (Role)
     {
         case User.UserRole.PC:
             //PC端客戶在線數
             ServerStatistics.Online_PC++;
             //PC端客戶最高在線數
             if (ServerStatistics.MaxOnline_PC < ServerStatistics.Online_PC)
                 ServerStatistics.MaxOnline_PC = ServerStatistics.Online_PC;
             break;
         case User.UserRole.Mobile:
             //移動端客戶在線數
             ServerStatistics.Online_Mobile++;
             //移動端客戶最高在線數
             if (ServerStatistics.MaxOnline_Mobile < ServerStatistics.Online_Mobile)
                 ServerStatistics.MaxOnline_Mobile = ServerStatistics.Online_Mobile;
             break;
         case User.UserRole.APP:
             //樂信APP短連接在線數
             ServerStatistics.Online_App++;
             //樂信APP短連接最高在線數
             if (ServerStatistics.MaxOnline_App < ServerStatistics.Online_App)
                 ServerStatistics.MaxOnline_App = ServerStatistics.Online_App;
             break;
         case User.UserRole.FileTransfer:
             //文件傳送客戶在線數
             ServerStatistics.Online_FileTransfer++;
             //文件傳送客戶最高在線數
             if (ServerStatistics.MaxOnline_FileTransfer < ServerStatistics.Online_FileTransfer)
                 ServerStatistics.MaxOnline_FileTransfer = ServerStatistics.Online_FileTransfer;
             break;
         case User.UserRole.SubService:
             //訂閱號服務端在線數
             ServerStatistics.Online_Subsrv++;
             //訂閱號服務端最高在線數
             if (ServerStatistics.MaxOnline_Subsrv < ServerStatistics.Online_Subsrv)
                 ServerStatistics.MaxOnline_Subsrv = ServerStatistics.Online_Subsrv;
             break;
         case User.UserRole.AudioCall:
             //語音通話客戶在線數
             ServerStatistics.Online_AudioCall++;
             //語音通話客戶最高在線數
             if (ServerStatistics.MaxOnline_AudioCall < ServerStatistics.Online_AudioCall)
                 ServerStatistics.MaxOnline_AudioCall = ServerStatistics.Online_AudioCall;
             break;
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 收集監視器數據之在線數統計-減少
        /// </summary>
        /// <param name="Role"></param>
        public static void OnlineStatRemove(User.UserRole Role)
        {
            switch (Role)
            {
                case User.UserRole.PC:
                    //PC端客戶在線數
                    ServerStatistics.Online_PC--;
                    break;
                case User.UserRole.Mobile:
                    //移動端客戶在線數
                    ServerStatistics.Online_Mobile--;
                    break;
                case User.UserRole.APP:
                    //樂信APP短連接在線數
                    ServerStatistics.Online_App--;
                    break;
                case User.UserRole.FileTransfer:
                    //文件傳送客戶在線數
                    ServerStatistics.Online_FileTransfer--;
                    break;
                case User.UserRole.SubService:
                    //訂閱號服務端在線數
                    ServerStatistics.Online_Subsrv--;
                    break;
                case User.UserRole.AudioCall:
                    //語音通話客戶在線數
                    ServerStatistics.Online_AudioCall--;
                    break;
            }

        }
Esempio n. 3
0
        public SocketUserToken(int receiveBufferSize)
        {
            m_connectSocket = null;
            m_asyncSendAgent = null;
            m_receiveEventArgs = new SocketAsyncEventArgs();
            m_receiveEventArgs.UserToken = this;
            m_asyncReceiveBuffer = new byte[receiveBufferSize];
            m_receiveEventArgs.SetBuffer(m_asyncReceiveBuffer, 0, m_asyncReceiveBuffer.Length);

            m_sendEventArgs = new SocketAsyncEventArgs();
            m_sendEventArgs.UserToken = this;

            m_receiveBuffer = new DynamicBufferManager(ServerConst.InitBufferSize);
            m_sendBuffer = new AsyncSendBufferManager(ServerConst.InitBufferSize);
            //存放接收到的待處理的數據
            //m_receiveQueue = Queue.Synchronized(new Queue());
            //0表示沒有續包
            //m_restPacketLength = 0;
            //默認為首包
            m_firstPacket = true;
            m_user = new Core.User();

            m_closing = false;
        }