コード例 #1
0
        protected override void Cleanup()
        {
            _cancellationTokenSource.Cancel();
            MulticastMemberships.Clear();

#if (NETSTANDARD1_5 || NETSTANDARD1_3)
            BackingUdpClient?.Dispose();
#else
            BackingUdpClient?.Close();
#endif

            _multicastAddress = null;
            _multicastPort    = 0;
            base.Cleanup();
        }
コード例 #2
0
        public void MulticastDropMembership(string ipLan, string mcastAddress)
        {
            if (!IsMulticastActive)
            {
                throw new ArgumentException("Multicast interface must be initialized before dropping multicast memberships");
            }

            if (!MulticastMemberships.ContainsKey(mcastAddress))
            {
                return;
            }

            BackingUdpClient.DropMulticastGroup(IPAddress.Parse(mcastAddress));

            MulticastMemberships.Remove(mcastAddress);
        }