Exemplo n.º 1
0
        private void btnChk_Click(object sender, EventArgs e)
        {
            int numPeers;

            rtOut.AppendText("running = " + server.isRunning() + "\n");

            numPeers = server.getNumPeers();
            rtOut.AppendText("peers = " + numPeers + "\n");

            int i = 0;

            for (int count = 0; count < numPeers;)
            {
                string hName = "";
                if (server.getPeerHostname(i, ref hName) != 0)
                {
                    rtOut.AppendText("\t" + i + ") " + hName + "\t");

                    if (server.peerIsLocal(i) == true)
                    {
                        rtOut.AppendText("local ");
                    }

                    if (server.peerIsConnected(i) == true)
                    {
                        rtOut.AppendText("connected ");
                    }

                    if (server.peerIsActivated(i) == true)
                    {
                        rtOut.AppendText("activated ");
                    }

                    if (server.peerIsAuthenticated(i) == true)
                    {
                        rtOut.AppendText("authenticated ");
                    }

                    rtOut.AppendText("\n");
                    i++;
                    count++;
                }
                else
                {
                    //make sure we have a correct number of peers
                    numPeers = server.getNumPeers();
                    i++;
                }
            }
        }