public MaxAPMControlClient()
 {
     InitializeComponent();
     this.DoBindDataSource();
     this.s = SocketsConnection.ConnectServer("127.0.0.1", 12004);
     if (this.s == null)
     {
         tbMsg.Text = "Connection failed";
     }
     else
     {
         tbMsg.Text = "Server connected";
     }
     //tbmsg.Text = "lslkdjf\r\nlskdjf\r\nsdkjfk";
 }
        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 losed";
                return;
            }
            SocketsConnection.SendData(this.s, buffer, -1);
            tbMsg.Text = "success";
        }
        private void btnSend_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 losed";
                return;
            }
            SocketsConnection.SendData(this.s, buffer, -1);
            tbMsg.Text = "success";
        }
        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 losed";
                return;
            }
            SocketsConnection.SendData(this.s, buffer, -1);
            tbMsg.Text = "success";
        }