コード例 #1
0
        private async static void GetUInt64()
        {
            var server = AllPet.Pipeline.PipelineSystem.CreatePipelineSystemV1(new AllPet.Common.Logger());

            server.OpenNetwork(new AllPet.peer.tcp.PeerOption());
            server.RegistModule("me", new GetUInt64Actor());
            server.Start();
            var remote = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("127.0.0.1"), 8888);

            //連接
            var systemref = await server.ConnectAsync(remote);

            var actor = server.GetPipeline(null, "this/me");
            GetUint64Command command = new GetUint64Command()
            {
                TableId = new byte[] { 0x02, 0x02, 0x03 },
                Key     = new byte[] { 0x14, 0x13 }
            };
            var bytes = ProtocolFormatter.Serialize <GetUint64Command>(Method.GetUint64, command);

            actor.Tell(bytes);

            server.CloseListen();
            server.CloseNetwork();
            server.Dispose();
        }
コード例 #2
0
        public void Handle(GetUint64Command command)
        {
            Console.WriteLine("GetUint64Command");
            var longValue = this.SimpleDb.GetUInt64Direct(command.TableId, command.Key);

            if (this.From != null)
            {
                var bytes = BitConverter.GetBytes(longValue);
                this.From.Tell(bytes);
            }
        }