示例#1
0
 public void OnUpdate()
 {
     if (m_Socket != null)
     {
         m_Socket.Update();
     }
 }
示例#2
0
        //------------------------------------------------------------
        public void EnterFrame()
        {
            if (!m_IsRunning)
            {
                return;
            }

            m_Socket.Update();


            if (m_WaitForReconnect)
            {
                if (NetCheck.IsAvailable())
                {
                    Reconnect();
                }
                else
                {
                    Debuger.Log(LOG_TAG_MAIN, "EnterFrame() 等待重连,但是网络不可用!");
                }
            }

            if (m_WaitForSendAuth)
            {
                VerifyAuth();
            }
        }
示例#3
0
        //------------------------------------------------------------
        public void EnterFrame()
        {
            if (!isRunning)
            {
                return;
            }

            m_Socket.Update();


            if (m_WaitForReconnect)
            {
                if (NetCheck.IsAvailable())
                {
                    Reconnect();
                }
                else
                {
                    MyLogger.Log(LOG_TAG_MAIN, "EnterFrame() wait for reconnection,but network is not available!");
                }
            }

            if (m_WaitForSendAuth)
            {
                VerifyAuth();
            }
        }
示例#4
0
        //=================================================================================


        //=================================================================================
        #region 主线程驱动

        public void RPCTick()
        {
            if (m_IsRunning)
            {
                m_Socket.Update();
            }
        }
示例#5
0
 //=====================================================================
 #region 主线程驱动
 public void RPCTick()
 {
     if (m_IsRunning && m_Socket != null)
     {
         m_Socket.Update();
     }
 }
示例#6
0
        public void EnterFrame()
        {
            if (m_IsRunning)
            {
                m_GameSocket.Update();
                m_RoomRPC.RPCTick();

                if (m_Game != null)
                {
                    m_Game.EnterFrame();
                }
            }
        }
示例#7
0
    public void EnterFrame()
    {
        if (!m_IsRunning)
        {
            return;
        }
        m_Socket.Update();

        if (m_WaitForReconnect)
        {
            Reconnect();
        }

        if (m_WaitForSendAuth)
        {
            VerifyAuth();
        }
    }
示例#8
0
        static void TestSocket()
        {
            UInt32 conv       = 0x12345678;
            var    counter    = 1;
            var    originText = "a quick brown fox jumps over the lazy dog";
            var    rawbytes   = Encoding.UTF8.GetBytes(String.Format("{0} {1}", originText, counter));

            KCPSocket sock = new KCPSocket();

            sock.SetHandler((byte[] data, int size) =>
            {
                Console.WriteLine(Encoding.UTF8.GetString(data, 0, size));

                Thread.Sleep(500);
                rawbytes = Encoding.UTF8.GetBytes(String.Format("{0} {1}", originText, ++counter));
                sock.Send(rawbytes, 0, rawbytes.Length);
            });

            sock.Connect(conv, "127.0.0.1", 9527);
            sock.StartRead();
            sock.Send(rawbytes, 0, rawbytes.Length);

            while (true)
            {
                Thread.Sleep(100);
                try
                {
                    sock.Update(Utils.iclock());
                }
                catch (Exception ex)
                {
                    sock.Close();
                    Console.WriteLine("Exception: {0}", ex);
                    break;
                }
            }
        }