Esempio n. 1
0
 private void Tcp_Btn_DisCon_Click(object sender, EventArgs e)
 {
     if (tcla != null)
     {
         tcla.setExitClickedState(true);
     }
     if (tserv != null)
     {
         tserv.setExitClickedState(true);
     }
     //comboBox5 -> IP, comboBox6 -> Port
     if (Tcp_Btn_DisCon.Text == "연결")
     {
         if (ServerCheck.Checked == true)
         {
             int port = Int32.Parse(PortNumber.Text);
             tserv = new Tserv(this, port, gridview, GridList);
             tserv.ServerStart();
         }
         else
         {
             int    port = Int32.Parse(PortNumber.Text);
             string ip   = IpNumber.Text;
             tcla = new Tserv(this, ip, port, gridview, GridList);
             tcla.Connect();
         }
         Tcp_Btn_DisCon.Text = "연결해제";
         return;
     }
     else if (Tcp_Btn_DisCon.Text == "연결해제")
     {
         if (tserv != null && isServ == true)
         {
             tserv.ServerStop();
         }
         else if (tcla != null && isServ == false)
         {
             tcla.DisConnect();
             for (int i = 0; i < GridList.Count; i++)
             {
                 if (GridList[i].Type == "TCP Server")
                 {
                     fixGridListSequence(i);
                 }
             }
         }
     }
     Tcp_Btn_DisCon.Text = "연결";
 }
Esempio n. 2
0
 private void button3_Click(object sender, EventArgs e)
 {
     //comboBox5 -> IP, comboBox6 -> Port
     if (ServerCheck.Checked == true)
     {
         int port = Int32.Parse(PortNumber.Text);
         tserv = new Tserv(this, port);
         tserv.ServerStart();
     }
     else
     {
         int    port = Int32.Parse(PortNumber.Text);
         string ip   = IpNumber.Text;
         tcla = new Tserv(this, ip, port);
         tcla.Connect();
     }
 }