Exemple #1
0
 private void tmrConnCheck_Tick(object sender, EventArgs e)
 {
     if (rB_tcp.Checked)
     {
         if (tServer == null)
         {
             lblStat.Text = "Conn: NULL";
         }
         else
         {
             csConnStatus conn = tServer.ServerStatus();
             lblStat.Text = "Conn: " + conn.ToString();
         }
     }
     else if (rB_udp.Checked)
     {
         if (uServer == null)
         {
             lblStat.Text = "Conn: NULL";
         }
         else
         {
             csUdpConnStatus conn = uServer.ServerStatus();
             lblStat.Text = "Conn: " + conn.ToString();
         }
     }
 }
 private void tmChk_Tick(object sender, EventArgs e)
 {
     if (tcpServer == null)
     {
         lblStat.Text = "Status: NULL";
     }
     else
     {
         csConnStatus conn = tcpServer.ServerStatus();
         lblStat.Text = "Status: " + conn.ToString();
     }
 }
        //private void calculatePrimeNumber(int min, int max)
        //{
        //    // Recording Receiving Time
        //    DateTime stime1 = DateTime.Now;
        //    int cnt = 0;
        //    IsPrime.Clear();
        //    NumPNOrg.Clear();
        //    for (int i = min; i <= max; i++)
        //    {
        //        if (isPrimeNumber(i))
        //        {
        //            cnt++;
        //        }
        //        NumPNOrg.Add(cnt);
        //    }
        //    double dtime1 = Util.TimeInSeconds(stime1);
        //}

        //private bool isPrimeNumber(int n)
        //{
        //    int nchkmax = Convert.ToInt32(Math.Sqrt((double)n));
        //    bool isPrime = true;                //Initialize Prime Flag
        //    for (int i = 2; i <= nchkmax; i++)
        //    {
        //        if (n % i == 0)
        //        {
        //            isPrime = false;
        //            break;                      // the number is not prime number
        //        }
        //    }
        //    return isPrime;
        //}

        private void tmChk_Tick(object sender, EventArgs e)
        {
            if (clientCalc1 == null)
            {
                lblStat1.Text = "Status1: NULL";
                lblRsp1.Text  = "Respond1: NULL";
            }
            else
            {
                csConnStatus conn = clientCalc1.ClientStatus();
                lblStat1.Text = "Status1 : " + conn.ToString();
            }

            if (clientCalc2 == null)
            {
                lblStat2.Text = "Status2: NULL";
                lblRsp2.Text  = "Respond2: NULL";
            }
            else
            {
                csConnStatus conn = clientCalc2.ClientStatus();
                lblStat2.Text = "Status2 : " + conn.ToString();
            }
        }