//open server panel private void button2_Click(object sender, EventArgs e) { clientMode = false; this.Controls.Remove(panel1); this.Controls.Add(panel2); AsynchronousServer.console = this.serverConsole; //link forms for static usage AsynchronousServer.consoleContainer = this.panel6; AsynchronousServer.list = this.panel5; //link list of all connected clients if (!AsynchronousServer.runningServer) { this.serverConsole.Text = ""; AsynchronousServer.StartListening(); //autostarts server } }
//connect server if not already private void connect2(object sender, EventArgs e) { if (AsynchronousServer.runningServer) { showAlert("Server already running"); } else { String data = this.textBox2.Text; if (data.Length > 0) { //get data from input box, and start server this.clientMode = false; AsynchronousServer.port = Int32.Parse(data); AsynchronousServer.StartListening(); } else { showAlert("Bad adress, only allowed ip:port combination"); } } }