예제 #1
0
파일: GlueForm.cs 프로젝트: itadapter/nfx
        private void button2_Click(object sender, EventArgs ea)
        {
          var CNT = edRepeat.Text.AsInt();
         
          var client = new JokeContractClient(cbo.Text);

          client.Headers.Add( new AuthenticationHeader( new IDPasswordCredentials(tbID.Text, tbPwd.Text)) );
          
        //  client.ReserveTransport = true;
          var w = Stopwatch.StartNew();

          try
          {
            if (chkUnsecureEcho.Checked)
            {
                for(int i=0; i<CNT; i++)
                 client.UnsecureEcho("Hello!");
            }
            else
            {
               for(int i=0; i<CNT; i++)
                 client.Echo("Hello!");
            }

            w.Stop();
            Text = "Echoed  "+CNT.ToString()+" in " + w.ElapsedMilliseconds + " ms";
          }
          catch (Exception e)
          {
            Text = e.ToMessageWithType();
          }
          
          client.Dispose();
        }
예제 #2
0
파일: GlueForm.cs 프로젝트: itadapter/nfx
        private void btnSimple_Click(object sender, EventArgs e)
        {
            warmup();
            var unsecure = chkUnsecureEcho.Checked;
            Text = "Working...";
            tbNote.Text = "Started...";
            var w = Stopwatch.StartNew();
            
                var client = new JokeContractClient(cbo.Text);
 client.DispatchTimeoutMs = 5 * 1000;
 client.TimeoutMs = 40 * 1000;             
                if (!unsecure && chkImpersonate.Checked)
                    client.Headers.Add( new AuthenticationHeader( new IDPasswordCredentials(tbID.Text, tbPwd.Text)) );

                var totalCalls = tbCallsPerReactor.Text.AsInt();

                var totalErrors = 0;
                
                
                    System.Threading.Tasks.Parallel.For(0, totalCalls,
                        (i) =>
                        {
                            try 
                            { 
                              if (unsecure)
                                client.UnsecureEcho("Call number {0} ".Args(i));
                              else
                                client.Echo("Call number {0} ".Args(i));
                            }
                            catch (Exception) 
                            {
                              Interlocked.Increment(ref totalErrors);
                            }
                        });


            var allFinished = w.ElapsedMilliseconds;

            Text = "Placed {0:n2} calls in {1:n2} ms total time {2:n2} ms @ {3:n2} calls/sec; totalErrors={4:n2} "
                   .Args
                   (
                     totalCalls,
                     allFinished,
                     allFinished,
                     totalCalls / (allFinished/1000d),
                     totalErrors
                   );
        }
예제 #3
0
파일: GlueForm.cs 프로젝트: itadapter/nfx
        private void button1_Click(object sender, EventArgs ea)
        {
          ECHO_COUNT++;

          var client = new JokeContractClient(cbo.Text);
          
          client.Headers.Add( new AuthenticationHeader( new IDPasswordCredentials(tbID.Text, tbPwd.Text)) );

          
          try
          {
            var echoed = chkUnsecureEcho.Checked ? client.UnsecureEcho("Hello!") : client.Echo("Hello!");
            Text = echoed + "  " + ECHO_COUNT.ToString() + " times";
          }
          catch (Exception e)
          {
            Text = e.ToMessageWithType();
          }

          client.Dispose();
        }