예제 #1
0
 private void button1_Click(object sender, System.EventArgs e)
 {
     tcp           = new TCP();
     serve_sendata = tcp.TCPserve();
     System.Timers.Timer timer = new System.Timers.Timer();
     timer.Enabled  = true;
     timer.Interval = 30;//执行间隔时间,单位为毫秒;此时时间间隔为30ms
     timer.Start();
     timer.Elapsed += new System.Timers.ElapsedEventHandler(serve_test);
 }
예제 #2
0
 private void button2_Click(object sender, System.EventArgs e)
 {
     try
     {
         client_tcp     = new TCP();
         client_sendata = tcp.TCPclient(textBox_clientIPaddress.Text, textBox_clientPort.Text);
     }
     catch
     {
         MessageBox.Show("无法与服务器通讯");
     }
 }
예제 #3
0
 private void button2_Click(object sender, System.EventArgs e)
 {
     try
     {
         client_tcp     = new TCP();
         client_sendata = client_tcp.TCPclient(textBox_clientIPaddress.Text, textBox_clientPort.Text);
         System.Timers.Timer timer = new System.Timers.Timer();
         timer.Enabled  = true;
         timer.Interval = 30;//执行间隔时间,单位为毫秒;此时时间间隔为30ms
         timer.Start();
         timer.Elapsed += new System.Timers.ElapsedEventHandler(client_test);
     }
     catch
     {
         MessageBox.Show("无法与服务器通讯");
     }
 }
예제 #4
0
 private void button1_Click(object sender, System.EventArgs e)
 {
     tcp     = new TCP();
     sendata = tcp.TCPserve();
 }