/// <summary> /// Start a multi-cast listener /// </summary> /// <returns></returns> internal async Task StartMulticastListener() { if (mcastListener == null) { //this.router.AddDefaultMulticastRoute(defaultHandler); mcastListener = new MulticastListener(options, loggerFactory); await mcastListener.StartAsync((m) => { log.Trace($"Received {m.GetType().Name} with {m.DateTimeUtc.ToDefaultWithTime()}"); this.router.Route(m); }); } else { log.Warning("Multicast Listener already started - only one instance is allowed, request ignored"); } }
/// <summary> /// /// </summary> public void StopMulticastListener() { mcastListener?.Stop(); mcastListener = null; }