public TcpBridgeSettings(TcpBridgeSettings settings) { PublicEndPoint = new NetworkPoint(settings.PublicEndPoint); ListenEndPoint = new NetworkPoint(settings.ListenEndPoint); ClientEndPoints = new List <NetworkPoint>(); foreach (NetworkPoint tcpEndpoint in settings.ClientEndPoints) { ClientEndPoints.Add(new NetworkPoint(tcpEndpoint)); } ServerSettings = new AsyncEventSettings(settings.ServerSettings); }
/// <summary> /// Creates a new instance of <see cref="TcpBridge"/> /// </summary> /// <param name="settings">Configuration</param> public TcpBridge(TcpBridgeSettings settings) { _settings = new TcpBridgeSettings(settings); _clients = new List <IPEndPoint>(); _consumer = new GenericConsumer <Message>(); _consumer.ReceivedGeneric += ConsumerOnReceivedGeneric; _endPointLookup = new Dictionary <ITcpSocket, IPEndPoint>(); _socketLookup = new Dictionary <IPEndPoint, ITcpSocket>(); _queued = new Dictionary <ITcpSocket, Queue <Message> >(); _tcpServer = new AsyncEventServer(_settings.ListenEndPoint.Address, _settings.ListenEndPoint.Port, this, settings.ServerSettings); foreach (NetworkPoint networkPoint in _settings.ClientEndPoints) { _clients.Add(networkPoint.ToIpEndPoint()); } }