diff --git a/src/MulticastClient.cs b/src/MulticastClient.cs index f7de790..15d823d 100644 --- a/src/MulticastClient.cs +++ b/src/MulticastClient.cs @@ -95,6 +95,7 @@ public MulticastClient(bool useIPv4, bool useIpv6, IEnumerable throw new NotSupportedException($"Address family {address.AddressFamily}."); } + receivers.Add(sender); log.Debug($"Will send via {localEndpoint}"); if (!senders.TryAdd(address, sender)) // Should not fail { @@ -197,21 +198,6 @@ protected virtual void Dispose(bool disposing) } } receivers.Clear(); - - foreach (var address in senders.Keys) - { - if (senders.TryRemove(address, out var sender)) - { - try - { - sender.Dispose(); - } - catch - { - // eat it. - } - } - } senders.Clear(); }