public SocketHostedService(ISocketServer socketTcpServer, ISocketClientDictionary <string, UserToken> socketClientDictionary, IProtocolFactory protocolFactory, ISocketSendServer socketSendServer, IOptionsMonitor <CollectionSetting> kj1012CollectionSetting, ILogger <SocketHostedService> logger) { _socketTcpServer = socketTcpServer; _socketClientDictionary = socketClientDictionary; _protocolFactory = protocolFactory; _socketSendServer = socketSendServer; _kj1012CollectionSetting = kj1012CollectionSetting.CurrentValue; _socketTcpServer.Listening += SocketTcpServer_Listening; _socketTcpServer.ClientConnected += SocketTcpServer_ClientConnected; _socketTcpServer.ReceiveData += SocketTcpServer_ReceiveData; _socketTcpServer.ClientClose += SocketTcpServer_ClientClose; _socketTcpServer.Error += SocketTcpServer_Error; _socketTcpServer.SetKeepAlive(true, 1000, 500); _logger = logger; }