static void Main(string[] args) { LogAction.LogOut += LogAction_LogOut; CloudClient client = new CloudClient(new SocketClient(), 500000, 1024 * 1024); //最大数据包能够接收 1M PackHander tmp = new PackHander(); client.Install(tmp); client.Disconnect += Client_Disconnect; if (client.Connect("127.0.0.1", 2285)) { ZYSync Sync = client.Sync; var res = Sync.CR(1000, "AAA", "BBB")?[0]?.Value <bool>(); if (res != null && res == true) { var html = Sync.CR(2001, "http://www.baidu.com")?[0]?.Value <string>(); if (html != null) { Console.WriteLine("BaiduHtml:" + html.Length); var time = Sync.CR(2002)?.First?.Value <DateTime>(); Console.WriteLine("ServerTime:" + time); Sync.CV(2003, "123123"); var x = Sync.CR(2001, "http://www.qq.com"); Console.WriteLine("QQHtml:" + x.First.Value <string>().Length); var recx = Sync.CR(2500, 100)?.First?.Value <int>(); System.Diagnostics.Stopwatch stop = new System.Diagnostics.Stopwatch(); stop.Start(); var rec = Sync.CR(2500, 10000)?.First?.Value <int>(); stop.Stop(); if (rec != null) { Console.WriteLine("Rec:{0} time:{1} MS", rec.Value, stop.ElapsedMilliseconds); } RunTest(client); } } Console.WriteLine("Close"); Console.ReadLine(); } }
static void Main(string[] args) { LogAction.LogOut += LogAction_LogOut; CloudClient client = new CloudClient(new SocketClient(), 500000, 1024 * 1024); //最大数据包能够接收 1M PackHander tmp = new PackHander(); client.Install(tmp); client.Disconnect += Client_Disconnect; if (client.Connect("127.0.0.1", 2285)) { var ServerPacker = client.Sync.Get <IPacker>(); var isSuccess = ServerPacker.IsLogOn("123123", "3212312")?.First?.Value <bool>(); var html = ServerPacker.StartDown("http://www.baidu.com").First?.Value <string>(); Console.WriteLine("BaiduHtml:" + html.Length); var time = ServerPacker.GetTime(); Console.WriteLine("ServerTime:" + time); ServerPacker.SetPassWord("3123123"); System.Diagnostics.Stopwatch stop = new System.Diagnostics.Stopwatch(); stop.Start(); int c = ServerPacker.TestRec2(10000); stop.Stop(); Console.WriteLine("Rec:{0} time:{1} MS", c, stop.ElapsedMilliseconds); RunTest(client); Console.ReadLine(); } }