private async void Init() { var client = Dependency.Container.Resolve <CloudClient>(); PackHander tmp = new PackHander(); client.Install(tmp); client.Disconnect += Client_Disconnect; if (!await client.InitAsync("192.168.1.33", 2285)) { await this.DisplayActionSheet("NOT CONNECT SERVER", "OK", ""); } }
partial void Start_TouchUpInside(UIButton sender) { 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; var ServerIP = "SERVER IP"; if (ServerIP == "SERVER IP") { throw new Exception("Please edit ServerIP"); } if (client.Connect(ServerIP, 2285)) { var ServerPacker = client.Sync; var isSuccess = ServerPacker.CR(1000, "123123", "3212312")?.First?.Value <bool>(); var html = ServerPacker.CR(2001, "http://www.baidu.com").First?.Value <string>(); AddText("BaiduHtml:" + html.Length); var time = ServerPacker.CR(2002)?.First?.Value <DateTime>(); AddText("ServerTime:" + time); ServerPacker.CV(2003, "3123123"); System.Diagnostics.Stopwatch stop = new System.Diagnostics.Stopwatch(); stop.Start(); int?c = ServerPacker.CR(2500, 1000)?.First?.Value <int>(); stop.Stop(); AddText(string.Format("Rec:{0} time:{1} MS", c, stop.ElapsedMilliseconds)); client.Client.Close(); } }