Пример #1
0
 public void KcpReceive()
 {
     while (true)
     {
         int rv_len = m_kcp.Recv(m_kcp_receiveBuffer);
         if (rv_len <= 0)
         {
             break;
         }
         else
         {
             Act_Act_Receive.InvokeGracefully(m_kcp_receiveBuffer.CloneRange(0, rv_len));
             //////////////////////////////////////////////////////////////////////////
         }
     }
 }
Пример #2
0
        public void KcpReceive()
        {
            int irv = -1;

            while (true)
            {
                irv = m_kcp.Recv(m_kcp_rv_buf);
                if (irv <= 0)
                {
                    break;
                }
                else
                {
                    NetDataReader dr = new NetDataReader();
                    dr.SetSource(m_kcp_rv_buf);
                    int iid = dr.PeekInt();
                    Console.WriteLine(iid);

                    KcpSend(m_kcp_rv_buf.CloneRange(0, irv));
                    //  m_kcp_rv_buf.CloneRange(0,irv);
                }
            }
        }