private void connectToToolStripMenuItem_Click(object sender, EventArgs e) { string port; //Pop up a form asking for port number to connect to using (PortPop popup = new PortPop()) { DialogResult dialogresult = popup.ShowDialog(); port = popup.Port; } int portNum; if (Int32.TryParse(port, out portNum)) { sendingSocket.Connect("127.0.0.1", portNum); } else { updateStatus(portNum + " is not a legitimate port number"); } }
private void startListeningToolStripMenuItem_Click(object sender, EventArgs e) { string port; //Pop up a form asking for port number to connect to using (PortPop popup = new PortPop()) { DialogResult dialogresult = popup.ShowDialog(); port = popup.Port; } // Call Listen() int portNum; if (Int32.TryParse(port, out portNum)) { Listen(portNum); } else { updateStatus(portNum + " is not a legitimate port number"); } }