Пример #1
0
        public static void Main(string[] arg)
        {
            int n = 10000;
            ServiceContainer container = new ServiceContainer();

            proxy = new MyProxy(new SocketPool(1, container,
                                               "127.0.0.1:11885"));
            DateTime start, end;
            TimeSpan duration;
            Param1   param = new Param1();

            param.Id       = 10;
            param.UserName = "******";
            Console.WriteLine("Client set value for remote service");
            Stopwatch watch = new Stopwatch();

            watch.Start();
            for (int i = 0; i < n; i++)
            {
                var sucess = proxy.SetValue(i, param);
//                Console.WriteLine(i + sucess.ToString());
            }
            watch.Stop();
            Console.WriteLine(string.Format("Client seted value for remote service. Execution took {0} miliseconds", (float)watch.ElapsedMilliseconds / n));

            /*Console.WriteLine("Client get value from remote service");
             * start = DateTime.Now;
             * int result = proxy.GetValueSimple();
             * end = DateTime.Now;
             * duration = end.Subtract(start);
             * Console.WriteLine("Client geted from remote service. value = {0}. Execution took {1} miliseconds", result, duration.TotalMilliseconds);
             */
            Console.WriteLine("press anyone key to exit");
            Console.ReadLine();
        }
Пример #2
0
        public static void Main(string[] arg)
        {
            int n = 10000;
            ServiceContainer container = new ServiceContainer();
            proxy = new MyProxy(new SocketPool(1, container,
                "127.0.0.1:11885"));
            DateTime start, end;
            TimeSpan duration;
            Param1 param = new Param1();
            param.Id = 10;
            param.UserName = "******";
            Console.WriteLine("Client set value for remote service");
            Stopwatch watch = new Stopwatch();
            watch.Start();
            for (int i = 0; i < n; i++)
            {
                var sucess = proxy.SetValue(i, param);
//                Console.WriteLine(i + sucess.ToString());
            }
            watch.Stop();
            Console.WriteLine(string.Format("Client seted value for remote service. Execution took {0} miliseconds", (float) watch.ElapsedMilliseconds / n));
            /*Console.WriteLine("Client get value from remote service");
            start = DateTime.Now;
            int result = proxy.GetValueSimple();
            end = DateTime.Now;
            duration = end.Subtract(start);
            Console.WriteLine("Client geted from remote service. value = {0}. Execution took {1} miliseconds", result, duration.TotalMilliseconds);
            */
            Console.WriteLine("press anyone key to exit");
            Console.ReadLine();
        }