public static void RemoveListener(IMulticastDNSListener listener)
        {
            if (listener == null)
            {
                throw new ArgumentNullException("listener");
            }

            bool stop = false;

            lock (_listeners)
            {
                if (!_listeners.Contains(listener))
                {
                    return;
                }

                _listeners.Remove(listener);

                if (_listeners.Count == 0)
                {
                    stop = true;
                    _shouldJoinChannel = false;
                }
            }

            if (stop)
            {
                CloseSharedChannel();
            }
        }
        public static async Task AddListenerAsync(IMulticastDNSListener listener)
        {
            if (listener == null)
            {
                throw new ArgumentNullException("listener");
            }

            lock (_listeners)
            {
                _listeners.AddOnce(listener);
                _shouldJoinChannel = true;
            }

            if (!IsJoined)
            {
                await OpenSharedChannelAsync().ConfigureAwait(false);
            }
        }