static DiscoveryTransportFactory() { DiscoveryTransportFactory.OnException += TransportFactory.HandleException; agent = new MulticastDiscoveryAgent(); agent.OnNewServiceFound += agent_OnNewServiceFound; agent.OnServiceRemoved += agent_OnServiceRemoved; }
public IDiscoveryAgent CreateAgent(Uri uri) { Tracer.DebugFormat("Creating DiscoveryAgent:[{0}]", uri); try { MulticastDiscoveryAgent agent = new MulticastDiscoveryAgent(); agent.DiscoveryURI = uri; // allow MDA's params to be set via query arguments // (e.g., multicast://default?group=foo StringDictionary parameters = URISupport.ParseParameters(uri); URISupport.SetProperties(agent, parameters); return(agent); } catch (Exception e) { throw new IOException("Could not create discovery agent", e); } }