unsafe public void Ordersend(int ordertype)
        {
            byte[] bytes = new byte[256];
            uint   len   = 256;//
            int    size  = 256;



            if (listBoxOnlineList.SelectedIndex == -1)
            {
                if (ordertype != 10)
                {
                    MessageBox.Show("请选择要发送的客户端!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    return;
                }
                else
                {
                    if (ordertype == 10)
                    {
                        int n = listBoxOnlineList.Items.Count;
                        selectClient = listBoxOnlineList.Items[n - 1].ToString();////最后一次连接的客户端
                    }
                    //return;
                }
            }
            //else
            {
                try
                {
                    if (ordertype != 10)
                    {
                        selectClient = listBoxOnlineList.Text;  //选择要发送的客户端
                    }
                    int ret = 0;

                    switch (ordertype)
                    {
                    case 1:    //总召
                        #region
                        ret = win_device_101act_call(flag, bytes, len);
                        #endregion
                        break;

                    case 2:    //对时
                        #region
                        //ret = win_device_101act_call(flag, bytes, ref len);
                        //win_device_101act_timesync(Balance101VariousFlag* rte, ref S_TIMESYN pTime, byte[] buf, ref int size)
                        //时间赋值
                        pTime.Time.Year = (UInt32)(DateTime.Now.Year);    //-2000
                        //pTime.Time.Year = 0;
                        pTime.Time.Month  = (UInt32)DateTime.Now.Month;
                        pTime.Time.Date   = (UInt32)DateTime.Now.Day;
                        pTime.Time.Hour   = (UInt32)DateTime.Now.Hour;
                        pTime.Time.Min    = (UInt32)DateTime.Now.Minute;
                        pTime.Time.Second = (UInt32)DateTime.Now.Second;
                        pTime.Time.Ms     = (UInt32)DateTime.Now.Millisecond;

                        ret = win_device_101act_timesync(flag, ref pTime, bytes, size);    //ref
                        int aaa = 1;
                        #endregion
                        break;


                    case 3:     //召目录
                    case 4:     //召文件
                        #region //win_device_101act_file(Balance101VariousFlag* rte, ref FILEOPERATE pOper, byte[] buf, int size)
                        //pOper.FileMenu.Call_Flag = 0;

                        FILEOPERATE pOper = new FILEOPERATE();

                        if (ordertype == 3)
                        {
                            #region
                            pOper.File_Oper = 1;
                            //public byte  Oper_ID;
                            //public long Menu_ID;
                            //public byte  Menu_Len;
                            //public fixed byte Menu[4351];
                            //public byte  Call_Flag;
                            //public TIMESTR StartTime;
                            //public TIMESTR EndTime;
                            //public byte alignment;
                            //pOper.FileMenu.Menu[0] = 51;
                            pOper.FileMenu.Oper_ID          = 1; //操作标识:1-读目录
                            pOper.FileMenu.Menu_ID          = 3; //目录ID
                            pOper.FileMenu.Menu_Len         = 1; //目录名长度
                            pOper.FileMenu.Call_Flag        = 0; //召唤标志:0-目录下所有文件;1-目录下满足搜索时间段的文件
                            pOper.FileMenu.StartTime.Year   = (UInt32)DateTime.Now.Year;
                            pOper.FileMenu.StartTime.Month  = (UInt32)DateTime.Now.Month;
                            pOper.FileMenu.StartTime.Date   = (UInt32)DateTime.Now.Day;
                            pOper.FileMenu.StartTime.Hour   = (UInt32)DateTime.Now.Hour;
                            pOper.FileMenu.StartTime.Min    = (UInt32)DateTime.Now.Minute;
                            pOper.FileMenu.StartTime.Second = (UInt32)DateTime.Now.Second;
                            pOper.FileMenu.StartTime.Ms     = (UInt32)DateTime.Now.Millisecond;
                            pOper.FileMenu.EndTime          = pOper.FileMenu.StartTime;
                            string source  = "3";
                            byte[] VerByte = System.Text.Encoding.ASCII.GetBytes(source);

                            for (int i = 0; i < source.Length; i++)
                            {
                                pOper.FileMenu.Menu[i] = VerByte[i];    //
                            }
                            //int length = 4351;//Marshal.Copy();



                            //pOper.FileMenu.Call_Flag = 1;
                            #endregion
                        }
                        else if (ordertype == 4)
                        {
                            #region

                            pOper.File_Oper = 2;
                            //public byte File_Oper_ID;
                            // public byte FileName_Len;
                            // public fixed byte FileName[4351];
                            // public fixed byte alignment[2];
                            //pOper.FileRead.FileName[0] = 0;
                            //int length = 4351;
                            //Marshal.Copy();
                            pOper.FileRead.File_Oper_ID = 3;                   //操作标识:3-读文件激活
                            pOper.FileRead.FileName_Len = 29;                  //文件长度:29
                            string file_cfg = "BAY01_20170222_151530_351.cfg"; //BAY01_20161109_133857_111.cfg
                            byte[] VerByte  = System.Text.Encoding.ASCII.GetBytes(file_cfg);
                            for (int i = 0; i < file_cfg.Length; i++)
                            {
                                pOper.FileRead.FileName[i] = VerByte[i];    //
                            }

                            pOper.FileRead.alignment[0] = 0;

                            #endregion
                        }

                        ret = win_device_101act_file(flag, ref pOper, bytes, size);    //ref
                        #endregion
                        //break;



                        break;

                    case 5:    //遥控选择
                        #region
                        //win_device_101act_yk(Balance101VariousFlag* rte, ref _YK pYk, byte[] buf, ref int size)
                        //ptr_YK.YkFlag;
                        ptr_YK.YkPot   = 0;//0x6001
                        ptr_YK.YkState = 0;
                        ret            = win_device_101act_yk(flag, ref ptr_YK, bytes, size);
                        #endregion
                        break;

                    case 6:    //遥控执行
                        #region
                        //ptr_YK.YkFlag;
                        ptr_YK.YkPot   = 0;  //0x6001
                        ptr_YK.YkState = 2;
                        ret            = win_device_101act_yk(flag, ref ptr_YK, bytes, size);
                        #endregion
                        break;

                    case 7:    //遥控取消
                        #region
                        //ptr_YK.YkFlag;
                        ptr_YK.YkPot   = 0;  //0x6001
                        ptr_YK.YkState = 4;
                        ret            = win_device_101act_yk(flag, ref ptr_YK, bytes, size);
                        #endregion
                        break;

                    case 10:    //定时触发式命令
                        #region
                        //win_device_101act_beat(Balance101VariousFlag *rte,byte[]buf, ref int size)
                        try
                        {
                            ret = win_device_101act_beat(flag, bytes, size);    //
                        }
                        catch
                        {
                            textBox1.AppendText(DateTime.Now.ToString() + "win_device_101act_beat调用异常" + "\r\n");
                        }
                        int aa = 1;
                        #endregion
                        break;
                    }

                    if (ret > 0)
                    {
                        string sendMsg   = "";
                        byte[] sendbytes = null;
                        int    sendlen   = 0;
                        if (ret == 5 || ret == 6)
                        {
                            sendlen   = ret;
                            sendbytes = new byte[ret];
                            for (int i = 0; i < ret; i++)
                            {
                                sendbytes[i] = bytes[i];
                            }
                        }
                        else if (ret > 6)//ret为返回报文长度
                        {
                            sendlen   = bytes[1] + 6;
                            sendbytes = new byte[sendlen];
                            for (int i = 0; i < sendlen; i++)
                            {
                                sendbytes[i] = bytes[i];
                            }

                            //调试===接收文件最后一帧后确认
                            if (ret == 28)
                            {
                                int fileend = 0;
                            }
                        }
                        sendMsg = byteToHexStr(sendbytes, sendlen);
                        dic[selectClient].Send(sendbytes);   //发送数据

                        textBox4.Clear();
                        textBox1.AppendText("服务器:" + GetCurrentTime() + "\r\n" + sendMsg + "\r\n");//
                        textBox4.AppendText(sendMsg);
                    }
                }
                catch (Exception ee)
                {
                    int aa = 0;
                }
            }

            //else

            //////BeginInvoke(new Action(() =>
            //////{

            //////}));
        }
 unsafe public static extern int win_device_101act_file(Balance101VariousFlag *rte, ref FILEOPERATE pOper, byte[] buf, int size);//ref