public ISocketServer CreateServer(ServerSetting setting)
        {
            using (var scope = _serviceProvider.CreateScope())
            {
                var injectSetting = scope.ServiceProvider.GetRequiredService <ServerSetting>();

                if (setting.ExtraSettings.Any())
                {
                    injectSetting.ExtraSettings.AddRange(setting.ExtraSettings);
                }


                injectSetting.ScanTimeoutRequestInterval      = setting.ScanTimeoutRequestInterval;
                injectSetting.SendMessageFlowControlThreshold = setting.SendMessageFlowControlThreshold;
                injectSetting.QuietPeriodMilliSeconds         = setting.QuietPeriodMilliSeconds;
                injectSetting.CloseTimeoutSeconds             = setting.CloseTimeoutSeconds;

                injectSetting.ListeningEndPoint      = setting.ListeningEndPoint;
                injectSetting.MessageReqCapacity     = setting.MessageReqCapacity;
                injectSetting.HandleMessageReqThread = setting.HandleMessageReqThread;

                //var injectServiceProvider = _serviceProvider.GetService<IServiceProvider>();


                var socketServer = scope.ServiceProvider.GetRequiredService <ISocketServer>();
                return(socketServer);
            }
        }
        public ISocketServer CreateServer(int port)
        {
            var setting = new ServerSetting()
            {
                ListeningEndPoint = new IPEndPoint(IPAddress.Any, port)
            };

            return(CreateServer(setting));
        }