Beispiel #1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            textBox1.Text = console.getText();
            try
            {
                if (server.getCmdHandler().on == false)
                {
                    Application.Exit();
                }
            }
            catch (Exception ex)
            {
                // code for debugging console.writeLine(ex.ToString());
            }

            try
            {
                if (cmdHandler.on == false)
                {
                    Application.Exit();
                }
            }
            catch (Exception ex)
            {
                // code for debugging console.writeLine(ex.ToString());
            }
            //populates listbox with ip addresses of connected clients
            try
            {
                for (int i = 0; i < server.allConnections.Count; i++)
                {
                    if (listBox1.Items.Contains(((Socket)server.allConnections[i].GetType().GetProperty("Socket", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(server.allConnections[i], null)).RemoteEndPoint.ToString()) != true)
                    {
                        listBox1.Items.Add(((Socket)server.allConnections[i].GetType().GetProperty("Socket", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(server.allConnections[i], null)).RemoteEndPoint.ToString());
                    }
                }
            }
            catch
            {
            }
        }
Beispiel #2
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     consoleBox.Text = console.getText();
 }