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(); }
private static void DeleteDirect() { var systemL = AllPet.Pipeline.PipelineSystem.CreatePipelineSystemV1(new AllPet.Common.Logger()); systemL.OpenNetwork(new AllPet.peer.tcp.PeerOption()); var remote = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("127.0.0.1"), 8888); var systemref = systemL.ConnectAsync(remote).Result; systemL.Start(); var actor = systemL.GetPipeline(null, "127.0.0.1:8888/simpledb"); { DeleteCommand command = new DeleteCommand() { TableId = new byte[] { 0x02, 0x02, 0x03 }, Key = new byte[] { 0x13, 0x13 }, }; var bytes = ProtocolFormatter.Serialize <DeleteCommand>(Method.Delete, command); actor.Tell(bytes); } systemL.CloseListen(); systemL.CloseNetwork(); systemL.Dispose(); }
private async static void GetDirect() { var server = AllPet.Pipeline.PipelineSystem.CreatePipelineSystemV1(new AllPet.Common.Logger()); server.OpenNetwork(new AllPet.peer.tcp.PeerOption()); server.RegistModule("me", new GetActor()); 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"); GetDirectCommand command = new GetDirectCommand() { TableId = new byte[] { 0x03, 0x02, 0x03 }, Key = new byte[] { 0x10, 0x10 } }; var bytes = ProtocolFormatter.Serialize <GetDirectCommand>(Method.GetDirect, command); actor.Tell(bytes); //var actor = server.GetPipeline(null, "127.0.0.1:8888/get"); //{ // MemoryStream ms = new MemoryStream(); // GetDirectCommand command = new GetDirectCommand() // { // TableId = new byte[] { 0x02, 0x02, 0x03 }, // Key = new byte[] { 0x13, 0x13 } // }; // BinaryFormatter bf = new BinaryFormatter(); // bf.Serialize(ms, command); // actor.Tell(ms.ToArray()); //} server.CloseListen(); server.CloseNetwork(); server.Dispose(); }