public void connect2Server(ClientTerminal s) { try { // toSever.Connect(remoteIPAddress, alPort); s.Connect(); } catch (SocketException se) { MessageBox.Show(se.Message); System.Environment.Exit(0); } }
private void cmdConnect_Click(object sender, EventArgs e) { try { string szIPSelected = txtIPAddress.Text; string szPort = txtPort.Text; int alPort = Convert.ToInt16(szPort, 10); IPAddress remoteIPAddress = IPAddress.Parse(szIPSelected); m_ClientTerminal.Connect(remoteIPAddress, alPort); } catch (SocketException se) { MessageBox.Show(se.Message); } }