private void btnSend_Click(object sender, EventArgs e)
        {
            String str = tbMsgSend.Text.Trim();

            byte[] buffer = System.Text.Encoding.Default.GetBytes(str);
            if (this.s == null || this.s.Connected == false)
            {
                tbMsg.Text = "Connection lost";
                return;
            }
            SocketsConnection.SendData(this.s, buffer, -1);
            tbMsg.AppendText(str);
        }
        private void btnVar_Click(object sender, EventArgs e)
        {
            String str = "3#";

            str += cbbLog4J.SelectedValue;

            byte[] buffer = System.Text.Encoding.Default.GetBytes(str);
            if (this.s == null || this.s.Connected == false)
            {
                tbMsg.Text = "Connection lost";
                return;
            }
            SocketsConnection.SendData(this.s, buffer, -1);
            tbMsg.AppendText(str);
        }
        private void btnSQL_Click(object sender, EventArgs e)
        {
            String str = "1#";

            str += tbSQL.Text;
            if (String.IsNullOrEmpty(tbSQL.Text.Trim()))
            {
                return;
            }
            byte[] buffer = System.Text.Encoding.Default.GetBytes(str);
            if (this.s == null || this.s.Connected == false)
            {
                tbMsg.Text = "Connection lost";
                return;
            }
            SocketsConnection.SendData(this.s, buffer, -1);
            tbMsg.AppendText(str);
        }
        private void btnConnect_Click(object sender, EventArgs e)
        {
            tbMsg.Text = "";
            string strIp = tbIp.Text.Trim();
            int    iPort = int.Parse(tbPort.Text.Trim());

            this.s = SocketsConnection.ConnectServer(strIp, iPort);
            //this.s = SocketsConnection.ConnectServer("127.0.0.1", 12004);
            if (this.s == null || this.s.Connected == false)
            {
                tbMsg.Text = "Connection failed";
            }
            else
            {
                tbMsg.Text  += "Connected to " + strIp + " " + iPort + "\r\n";
                threadClient = new Thread(ReciveMsg);
                threadClient.Start();
            }
        }
        private void ckbVar_CheckedChanged(object sender, EventArgs e)
        {
            String str = "2#";

            if (ckbVar.CheckState == CheckState.Checked)
            {
                str += "1";
            }
            else
            {
                str += "0";
            }

            byte[] buffer = System.Text.Encoding.Default.GetBytes(str);
            if (this.s == null || this.s.Connected == false)
            {
                tbMsg.Text = "Connection lost";
                return;
            }
            SocketsConnection.SendData(this.s, buffer, -1);
            tbMsg.AppendText(str);
        }