private void TCP_IPMenuForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (clientTcp != null)
            {
                clientTcp.DisconnectServer((error) =>
                {
                    if (error.ErrorCode != ClientErrorCode.None)
                    {
                        textBoxTCPTips.AppendText($"{error.ErrorStr}\r\n");
                    }
                });
            }
            clientTcp = null;
            clientUdp = null;

            FormManager.Instance.BackClose();
        }
 private void buttonUDPSend_Click(object sender, EventArgs e)
 {
     try
     {
         if (clientUdp == null)
         {
             if (this.m_curUdpServer == null)
             {
                 MessageBox.Show("Please select right host.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 return;
             }
             IPAddress  address = IPAddress.Parse(this.m_curUdpServer.ServerIP);
             IPEndPoint server  = new IPEndPoint(address, this.m_curUdpServer.ServerPort);
             clientUdp = new SocketUDPClient(server, (recvData) =>
             {
                 if (recvData.Length <= 0)
                 {
                     Console.WriteLine("receive data is null.");
                     return;
                 }
                 string data = Encoding.UTF8.GetString(recvData.RecvBuffer, 0, recvData.Length);
                 this.textBoxUDPReceive.AppendText($"{data}\r\n");
             });
         }
         string sendMsg = this.textBoxUDPSendMessage.Text.Trim();
         if (string.IsNullOrEmpty(sendMsg))
         {
             Console.WriteLine("send data is null.");
             return;
         }
         byte[] sendBuffer = Encoding.UTF8.GetBytes(sendMsg);
         clientUdp.SendTo(sendBuffer);
     }
     catch (Exception error)
     {
         Console.WriteLine($"UDPSend_Click Error: {error.Message}");
     }
 }