/// <summary> /// button_Stop_Click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button_Stop_Click(object sender, EventArgs e) { TimeMeasure Life = new TimeMeasure(); IsStart = false; switch (_clientServer) { case ClientServer.CLIENT: try { TheMinaTCPClient.CloseMinaSocket(); TheMinaTCPClient = null; UpdateText(String.Format("Close Mina-Socket {0} ms", Life.StrRunTime)); } catch (Exception ex) { UpdateText(String.Format("ERROR in TCP Client Close {0}", ex.Message)); } break; case ClientServer.SERVER: try { TheMinaTCPServer.StopMinaListener(); TheMinaTCPServer = null; UpdateText(String.Format("Stop Mina-Server {0} ms", Life.StrRunTime)); } catch (Exception ex) { UpdateText(String.Format("ERROR in TCP Server Close {0}", ex.Message)); } break; } EnableDisableControls(); }
/// <summary> /// button_Start_Click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button_Start_Click(object sender, EventArgs e) { TimeMeasure Life = new TimeMeasure(); IsStart = true; switch (_clientServer) { case ClientServer.CLIENT: try { TheMinaTCPClient = new MinaTCPClient(IPAddress.Parse(textBoxTCPIPAddress.Text), Convert.ToInt32(maskedTextBoxPort.Text.ToString()), UpdateText, UpdateProgressBar); TheMinaTCPClient.StressMinaSocket(Convert.ToInt32(labelPackageSizeValue.Text),Convert.ToInt32(labelSendDelayValue.Text)); } catch (Exception ex) { UpdateText(String.Format("Exeption in Start TCP Client {0}", ex.Message)); } break; case ClientServer.SERVER: try { TheMinaTCPServer = new MinaTCPServer(Convert.ToInt32(maskedTextBoxPort.Text.ToString()), UpdateText,UpdateProgressBar); UpdateText(String.Format("Start Mina-Server {0} ms",Life.StrRunTime)); } catch (Exception ex) { UpdateText(String.Format("Exeption in Start TCP Server {0}", ex.Message)); } break; } EnableDisableControls(); }