void Eventrec(object obj)
        {
            command cc = obj as command;

            ReceiveServerEvent?.Invoke(cc.comm, cc.str);
            ReceiveServerEventobj?.Invoke(cc.comm, cc.str, this);
        }
        void Unupjson()
        {
            try
            {
                {
                    int bytesRead = alldata.Length;

                    if (bytesRead == 0)
                    {
                        return;
                    }


                    byte[] tempbtye = new byte[bytesRead];

                    Array.Copy(alldata, tempbtye, tempbtye.Length);
                    //if (tempbtye[0] == 0x99)
                    //{
                    //    timeout = DateTime.Now;
                    //    if (tempbtye.Length > 1)
                    //    {
                    //        byte[] b = new byte[bytesRead - 1];
                    //        try
                    //        {
                    //            Array.Copy(tempbtye, 1, b, 0, b.Length);
                    //        }
                    //        catch { }
                    //        alldata = b;
                    //        return;
                    //    }
                    //}

                    if (bytesRead > 2)
                    {
                        int a = tempbtye[1];
                        if (bytesRead > 2 + a)
                        {
                            int len = 0;

                            string temp = System.Text.Encoding.UTF8.GetString(tempbtye, 2, a);
                            len = 0;
                            try
                            {
                                len = int.Parse(temp);
                                if (len == 0)
                                {
                                    alldata = new byte[0]; return;
                                }
                            }
                            catch
                            {
                                byte[] temps = new byte[tempbtye.Length - 1];
                                Array.Copy(tempbtye, 1, temps, 0, temps.Length);
                                alldata = temps;
                                return;
                            }

                            try
                            {
                                if ((len + 2 + a) > tempbtye.Length)
                                {
                                    return;
                                }
                                else if (tempbtye.Length > (len + 2 + a))
                                {
                                    byte[] temps = new byte[tempbtye.Length - (len + 2 + a)];
                                    Array.Copy(tempbtye, (len + 2 + a), temps, 0, temps.Length);
                                    alldata = temps;
                                    //  goto lb0x99;
                                }
                                else if (tempbtye.Length == (len + 2 + a))
                                {
                                    alldata = new byte[0];
                                }
                            }
                            catch (Exception e)
                            {
                                ErrorMge?.Invoke(3, e.StackTrace + "unup001:" + e.Message + "2 + a" + 2 + a + "---len" + len + "--tempbtye" + tempbtye.Length);
                                alldata = new byte[0];
                            }
                            try
                            {
                                temp = System.Text.Encoding.UTF8.GetString(tempbtye, 2 + a, len);

                                if (tempbtye[0] == 0xff)
                                {
                                    if (temp.IndexOf("token") >= 0)
                                    {
                                        Tokan = temp.Split('|')[1];
                                    }
                                    else if (temp.IndexOf("jump") >= 0)
                                    {
                                        Tokan = "连接数量满";
                                        JumpServerEvent(temp.Split('|')[1]);
                                    }
                                    else
                                    {
                                        //ReceiveServerEvent?.Invoke(tempbtye[0], temp);

                                        ReceiveServerEvent?.BeginInvoke(tempbtye[0], temp, null, null);
                                        ReceiveServerEventobj?.BeginInvoke(tempbtye[0], temp, this, null, null);
                                    }
                                }
                                else if (tempbtye[0] == 0x99)
                                {
                                    return;
                                }
                                else if (ReceiveServerEvent != null || ReceiveServerEventobj != null)
                                {
                                    command cc = new command();
                                    cc.comm = tempbtye[0];
                                    cc.str  = temp;
                                    System.Threading.ThreadPool.QueueUserWorkItem(new WaitCallback(Eventrec), cc);
                                    //ReceiveServerEvent?.BeginInvoke(tempbtye[0], temp, null, null);
                                    //ReceiveServerEventobj?.BeginInvoke(tempbtye[0], temp, this, null, null);
                                }
                            }
                            catch (Exception e)
                            {
                                ErrorMge?.Invoke(3, e.StackTrace + "unup122:" + e.Message);
                                alldata = new byte[0];
                            }
                        }
                        else
                        {
                            return;
                        }
                    }
                    else
                    {
                        return;
                    }
                }
            }
            catch (Exception e)
            {
                ErrorMge?.Invoke(3, "unup:" + e.Message + "---" + e.StackTrace);
                alldata = new byte[0];
            }
        }