Exemple #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));
 }
Exemple #2
0
        public static SendBuf From(byte[] buf, int off, int len)
        {
            var sendBuf = new SendBuf();

            sendBuf.off = off;
            sendBuf.len = len;
            sendBuf.buf = buf;

            return(sendBuf);
        }
Exemple #3
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));
        }
Exemple #4
0
 private void Send(int id, byte[] content)
 {
     mChannel.Send(SendBuf.From(DCGameProtocol.GetIntBuf(id)), SendBuf.From(content));
 }