private void Init_Button(object sender, EventArgs e) { Init(); var port = 11000; if (!int.TryParse(port_text.Text, out port)) { port = 11000; port_text.Text = "11000"; } if (ServerSelect.Checked) { server = new NetworkServer(port); ServerIP.Text = server.GetLocalIP(); if (!server.CheckStartServer(500)) { MessageBox.Show("Error , build server error!"); return; } refresh_button(null, null); } else { string ip = ServerIP.Text; client = new NetworkClient(ip, port); if (!client.CheckStartClient(500)) { MessageBox.Show("Error , Connect to server timeout!"); return; } refresh_button(null, null); } }