Beispiel #1
0
 public void ProcessMessage()
 {
     if (m_scoket != null)
     {
         m_scoket.ProcessMessage();
     }
 }
Beispiel #2
0
 public void ProcessMessage()
 {
     if (m_scoket != null)
     {
         uint uBeatType = m_gameReceiver.GetBeatType();
         if (uBeatType > 0 && mbConnected)
         { //发送心跳
             long iSceneds      = DateTime.Now.Ticks / 10000000;
             long iMilisceneds  = DateTime.Now.Ticks / 10000;
             long iBeatInterval = (long)m_gameReceiver.GetBeatInterval();
             long nSend;
             if (uBeatType == 1)
             {
                 long iCheckInterval = (long)m_gameReceiver.GetCheckInterval();
                 long nRecv;
                 nRecv = (iSceneds - miRecvLastMsgTime);
                 nSend = (iSceneds - miLastSendBeatTime);
                 if (nRecv >= iBeatInterval && nSend >= iBeatInterval)
                 {
                     miLastSendBeatTime = iSceneds;
                     m_gameSender.SendBeat();
                 }
                 iSceneds = DateTime.Now.Ticks / 10000000;
                 nRecv    = (iSceneds - miRecvLastMsgTime);
                 nSend    = (iSceneds - miCheckTime);
                 if (nRecv > iCheckInterval && nSend > iCheckInterval)
                 {
                     miCheckTime   = iSceneds;
                     mbConnected   = false;
                     mbSocketBlock = true;
                     ///通知逻辑层检查网络状态,Failed重连网络[1]
                     VarList varlist = VarList.GetVarList();
                     Excute_CallBack("on_connect_block", varlist);
                     varlist.Collect();
                 }
             }
             else if (uBeatType == 2)
             {
                 long iCheckInterval = (long)m_gameReceiver.GetCheckInterval();
                 long nRecv;
                 nRecv = (iSceneds - miRecvLastMsgTime) * 3;
                 nSend = (iSceneds - miLastSendBeatTime) * 3;
                 //   if (nRecv >= iBeatInterval && nSend >= iBeatInterval)
                 if (iSceneds - miLastSendBeatTime >= iBeatInterval)
                 {
                     miLastSendBeatTime = iSceneds;
                     m_gameSender.SendTracert(0);
                 }
                 iSceneds = DateTime.Now.Ticks / 10000000;
                 nRecv    = (iSceneds - miRecvLastMsgTime);
                 nSend    = (iSceneds - miCheckTime);
                 if (nRecv > iCheckInterval && nSend > iCheckInterval)
                 {
                     miCheckTime   = iSceneds;
                     mbConnected   = false;
                     mbSocketBlock = true;
                     ///通知逻辑层检查网络状态,Failed重连网络[1]
                     VarList varlist = VarList.GetVarList();
                     Excute_CallBack("on_connect_block", varlist);
                     varlist.Collect();
                 }
             }
         }
         m_scoket.ProcessMessage();
     }
 }