public MulticastPublisherReader( string name, Group group, int incomingSocketPort, int maxMessageSize, IChannelReaderConsumer consumer, ILogger logger) { _name = name; _maxMessageSize = maxMessageSize; _consumer = consumer; _logger = logger; _groupAddress = new IPEndPoint(IPAddress.Parse(group.Address), group.Port); _messageQueue = new ConcurrentQueue <RawMessage>(); _publisherChannel = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); _publisherChannel.Blocking = false; _publisherChannel.ExclusiveAddressUse = false; // binds to an assigned local address that is // published as my availabilityMessage _publisherChannel.Bind(new IPEndPoint(IPAddress.Any, 0)); _readChannel = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); _readChannel.Blocking = false; _readChannel.ExclusiveAddressUse = false; _readChannel.Bind(new IPEndPoint(IPAddress.Any, incomingSocketPort)); _readChannel.Listen(120); _publisherAddress = (IPEndPoint)_readChannel.LocalEndPoint; _clientReadChannels = new ConcurrentBag <Socket>(); _socketChannelSelectionReader = new SocketChannelSelectionReader(this, logger); _availability = AvailabilityMessage(); _logger.Debug($"Creating MulticastPublisherReader with read channel on {_readChannel.LocalEndPoint} on port {incomingSocketPort}"); }