예제 #1
0
 //窗口关闭
 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (tcp != null && tcp.IsConnected)
     {
         tcp.Close();
     }
 }
예제 #2
0
        public void Close()
        {
            if (tcpClient != null && tcpClient.IsConnected)
            {
                tcpClient.Close();
            }

            if (opcClient != null)
            {
                opcClient.Close();
            }
        }