Esempio n. 1
0
        public void StressPerformanceTest(int cnt)
        {
            var server = SimpleSocket.CreateServer(new Calculator());
            var client = new SimpleSocketClient <SimpleData, SimpleData>();

            try
            {
                server.Start();
                var          sw     = Stopwatch.StartNew();
                IList <Task> agenda = new List <Task>();
                for (var i = 0; i <= cnt; i++)
                {
                    agenda.Add(client.CallAsync(new SimpleData {
                        Command = 1, Arg = i, Arg2 = i
                    }));
                }
                Task.WaitAll(agenda.ToArray());
                sw.Stop();
                Console.WriteLine(sw.Elapsed);
                Console.WriteLine(((decimal)cnt) / ((decimal)sw.Elapsed.TotalMilliseconds) * 1000m);
            }
            finally
            {
                server.Stop();
            }
        }
Esempio n. 2
0
 /// <summary>
 /// </summary>
 /// <param name="request"></param>
 /// <returns></returns>
 public async Task <AuthProtocol> ExecuteAsync(AuthProtocol request)
 {
     return(await _client.CallAsync(request));
 }