コード例 #1
0
        static void Main(string[] args)
        {
            Console.OutputEncoding = System.Text.Encoding.UTF8;


            CloudClient client = new ClientBuilder().Bulid();
            PackHander  tmp    = new PackHander();

            client.Install(tmp);
            client.Disconnect += Client_Disconnect;


            if (client.Init("127.0.0.1", 2285))
            {
                IPacker ServerPack = client.GetForEmit <IPacker>();
re:
                try
                {
                    var res = ServerPack.IsLogOn("AAA", "BBB")?[0]?.Value <bool>();

                    if (res != null && res == true)
                    {
                        var html = ServerPack.StartDown("http://www.baidu.com");



                        if (html != null)
                        {
                            Console.WriteLine("BaiduHtml:" + html.Length);


                            var time = ServerPack.GetTime();


                            ServerPack.ShowMessage("ff");


                            Console.WriteLine("ServerTime:" + time);

                            ServerPack.SetPassWord("123123");

                            var x = ServerPack.StartDown("http://www.qq.com");

                            Console.WriteLine("QQHtml:" + x.Length);

                            System.Diagnostics.Stopwatch stop = new System.Diagnostics.Stopwatch();
                            stop.Start();
                            var rec = ServerPack.TestRec(10000);
                            stop.Stop();

                            Console.WriteLine("Rec1:{0} time:{1} MS", rec, stop.ElapsedMilliseconds);


                            stop.Restart();
                            rec = ServerPack.TestRec(10000);
                            stop.Stop();
                            Console.WriteLine("Rec1:{0} time:{1} MS", rec, stop.ElapsedMilliseconds);

                            stop.Restart();
                            rec = ServerPack.TestRec(10000);
                            stop.Stop();
                            Console.WriteLine("Rec1:{0} time:{1} MS", rec, stop.ElapsedMilliseconds);

                            Console.WriteLine();
                            stop.Restart();
                            rec = ServerPack.TestRec2(10000);
                            stop.Stop();
                            Console.WriteLine("Rec2:{0} time:{1} MS", rec, stop.ElapsedMilliseconds);

                            stop.Restart();
                            rec = ServerPack.TestRec2(10000);
                            stop.Stop();
                            Console.WriteLine("Rec2:{0} time:{1} MS", rec, stop.ElapsedMilliseconds);

                            stop.Restart();
                            rec = ServerPack.TestRec2(10000);
                            stop.Stop();
                            Console.WriteLine("Rec2:{0} time:{1} MS", rec, stop.ElapsedMilliseconds);


                            TestRun(client);
                        }
                    }
                }
                catch (TimeoutException er)
                {
                    Console.WriteLine(er.ToString());
                }

                Console.WriteLine("Close");
                Console.ReadLine();

                goto re;
            }
        }