Exemple #1
0
        public static void ClassInitialized(TestContext testContext)
        {
            _clientWorker = new TCPClientWorker();

            firstHaflEOFBinary  = AssemblyPrep.EOFBinary.Take(AssemblyPrep.EOFBinary.Length / 2).ToArray();
            secondHaflEOFBinary = AssemblyPrep.EOFBinary.Skip(AssemblyPrep.EOFBinary.Length / 2).ToArray();
        }
Exemple #2
0
 private void startTcpWorker()
 {
     if (gateType == 1)
     {     // 连游戏节点,设置超时时间为30s
         m_socket.ReceiveTimeout = 30000;
     }
     m_tcpWorker = new TCPClientWorker(m_socket);
 }
Exemple #3
0
    private void StartTCPWorker()
    {
        if (gateType == 1)
        {
            m_socket.ReceiveTimeout = 20000;//20s
        }

        m_tcpWorker = new TCPClientWorker(m_socket);
    }
 internal RemoteProxy()
 {
     m_tcpWorker = new TCPClientWorker();
     m_tcpWorker.OnNetworkDisconnected = CloseHandler;
     localHandles = new Dictionary <string, string>();
     localHandles.Add("MissionReq", "MissionReq");
     localHandles.Add("CliEntityActionReq", "CliEntityActionReq");
     localHandles.Add("CliEntitySkillReq", "CliEntitySkillReq");
     localHandles.Add("UseSkillReq", "UseSkillReq");
     localHandles.Add("UseHpBottleReq", "UseHpBottleReq");
 }
        public void ReConnect()
        {
            float t = UnityEngine.Time.time;

            if (t - closeTimeStamp > (10 * 60) || connectCnt >= 10)
            {//断线后十分钟重启游戏,2分钟内多次重连
                LoggerHelper.Info("restart game");
                PlatformSdkManager.Instance.RestartGame();
                return;
            }
            LoggerHelper.Info("reconnect " + reConnectCnt);
            m_tcpWorker.Close();
            m_tcpWorker = null;
            m_tcpWorker = new TCPClientWorker();
            m_tcpWorker.OnNetworkDisconnected = CloseHandler;
            MogoWorld.rc = true;
            TimerHeap.AddTimer(3000, 0, MogoWorld.Login);
            reConnectCnt++;
            connectCnt++;
        }
Exemple #6
0
 public void Close()
 {
     if (this.m_socket != null)
     {
         try
         {
             this.m_socket.Shutdown(SocketShutdown.Both);
             this.m_socket.Close();
             this.m_socket = null;
         }
         catch (Exception ex)
         {
             Debug.LogFormat("Close Exception:{0}", ex.ToString());
         }
     }
     if (m_tcpWorker != null)
     {
         m_tcpWorker.Close();
         m_tcpWorker = null;
     }
 }
Exemple #7
0
 public void TestInitialize()
 {
     _clientWorker = new TCPClientWorker();
     _serverWorker = new TCPServerWorker();
 }