Пример #1
0
        private void showPeersToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (lstTrackerInfo.SelectedItems.Count > 0)
            {
                TrackerClient tracker = lstTrackerInfo.SelectedItems[0].Tag as TrackerClient;

                IEnumerable <IPEndPoint> peerEPs;

                if (tracker == null)
                {
                    peerEPs = _chat.DhtGetPeers();
                }
                else
                {
                    peerEPs = tracker.Peers;
                }

                string peers = "";

                foreach (IPEndPoint peerEP in peerEPs)
                {
                    peers += peerEP.ToString() + "\r\n";
                }

                if (peers == "")
                {
                    MessageBox.Show("No peer returned by the tracker.", "No Peer Available", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show(peers, "Peers List", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }