private void ConnectBtn_Click(object sender, EventArgs e) { try { Client server = new Client(this.ipBox.Text, Program.PORT); this.Hide(); this.pongForm.server = server; pongForm.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message, "error"); } }
private void ConnectBtn_Click(object sender, EventArgs e) { try { Client server = new Client(this.ipBox.Text, Constants.PORT); this.Hide(); this.pongForm.server = server; pongForm.Show(); } catch (Exception ex) { if (ex.GetType().Equals(typeof(SocketException))) { MessageBox.Show("Can't connect to server", "error"); } else { MessageBox.Show(ex.GetType().ToString(), "error"); } } }