public Listener( IPEndPoint endpoint, IMessageExchangerFactory requestResponserFactory, CancellationToken cancellationToken) { this.endpoint = endpoint; this.requestResponserFactory = requestResponserFactory; this.cancellationToken = cancellationToken; listener = new TcpListener(this.endpoint); }
public void AddListener( IPEndPoint endpoint, IMessageExchangerFactory messageExchangerFactory) { var listener = new Listener( endpoint, messageExchangerFactory, tokenSource.Token); listener.StartListening(); listeners.Add(listener); logger.LogInformation($"Server added new Listener. <Address:{endpoint.Address}, Port:{endpoint.Port}>"); }