예제 #1
0
 private void TestEcho(Packet packet)
 {
     //echo to client
     mChannel.Send(
         SendBuf.From(Encoding.UTF8.GetBytes("echo ")),
         SendBuf.From(packet.Bytes, 0, packet.Length));
 }
예제 #2
0
        public void OnMsg(Packet packet)
        {
            //首次连接第一个协议必须是user token

            var protoPacket = ProtoPacket.FromRecvBuf(packet.Bytes, 0, packet.Length);

            if (protoPacket.ProtoObj is PTestDemoClsReq req)
            {
                var f1 = req.F1;
                if (f1 == null)
                {
                    DCLog.Log("default is null");
                }
            }

            //echo to client
            mChannel.Send(
                SendBuf.From(Encoding.UTF8.GetBytes("echo ")),
                SendBuf.From(packet.Bytes, 0, packet.Length));
        }
예제 #3
0
 private void Send(int id, byte[] content)
 {
     mChannel.Send(SendBuf.From(DCGameProtocol.GetIntBuf(id)), SendBuf.From(content));
 }