Inheritance: Aegis.Network.Packet
示例#1
0
        private void OnSS_Register_Req(PacketRequest reqPacket)
        {
            PacketResponse resPacket = new PacketResponse(reqPacket);
            Int32 serverUid = reqPacket.GetInt32();

            _svrInfo = ServerCatalog.Items.Find(v => v.Uid == serverUid);
            if (_svrInfo == null)
                resPacket.ResultCodeNo = ResultCode.InvalidUid;
            else
            {
                resPacket.ResultCodeNo = ResultCode.Ok;
                _svrInfo.Status = ServerStatus.Activate;

                Logger.Write(LogType.Info, 2, "GameServer({0}) registered.", serverUid);
            }

            SendPacket(resPacket);
        }
示例#2
0
        private void SendAndResponse(PacketRequest reqPacket, Action<PacketResponse> actionOnReceived)
        {
            SendPacket(reqPacket,
            (p) =>
            {
                return reqPacket.SeqNo == PacketResponse.GetSeqNo(p);
            },
            (s, p) =>
            {
                PacketResponse packet = new PacketResponse(p);
                packet.SkipHeader();

                actionOnReceived(packet);
            });
        }
示例#3
0
        public override StreamBuffer Clone()
        {
            PacketResponse packet = new PacketResponse();
            packet.Write(Buffer);

            packet.ResetReadIndex();
            packet.ResetWriteIndex();
            packet.Read(ReadBytes);

            return packet;
        }