private void button1_Click(object sender, EventArgs e) { //初始化t2连接 if (!InitT2()) { return; } //打包请求报文 CT2Packer packer = new CT2Packer(2); sbyte strType = Convert.ToSByte('S'); sbyte intType = Convert.ToSByte('I'); packer.BeginPack(); //插件编号 packer.AddField("plugin_id", strType, 255, 4); //管理功能号 packer.AddField("function_id", intType, 255, 4); packer.AddStr("com.hundsun.fbase.f2core"); packer.AddInt(100); packer.EndPack(); //功能号,业务包 int iRet = conn.SendBiz(8, packer, 0, 0, 1); if (iRet < 0) { DisplayText(conn.GetErrorMsg(iRet)); } else { string error = null; CT2UnPacker unpacker = null; iRet = conn.RecvBiz(iRet, out error, out unpacker, 4000, 0); if (iRet == 0 || iRet == 1) { while (unpacker.IsEOF() != 1) { for (int i = 0; i < unpacker.GetColCount(); i++) { textBox1.Text += unpacker.GetStrByIndex(i) + " "; } textBox1.Text += "\r\n"; unpacker.Next(); } } else if (iRet < 0) { DisplayText(conn.GetErrorMsg(iRet)); } else if (iRet == 2) { DisplayText("解包失败"); } } packer.Dispose(); }