diff --git a/src/ServiceDiscovery.cs b/src/ServiceDiscovery.cs index 6c2f17d..89d2521 100644 --- a/src/ServiceDiscovery.cs +++ b/src/ServiceDiscovery.cs @@ -103,13 +103,28 @@ public ServiceDiscovery(MulticastService mdns) /// Asks other MDNS services to send their service names. /// /// - /// When an answer is received, is raised. + /// When an answer is received the event is raised. /// public void QueryAllServices() { Mdns.SendQuery(ServiceName, type: DnsType.PTR); } + /// + /// Asks instances of the specified service to send details. + /// + /// + /// The service name to query. Typically of the form "_service._tcp". + /// + /// + /// When an answer is received the event is raised. + /// + /// + public void QueryServiceInstances(string service) + { + Mdns.SendQuery(service + ".local", type: DnsType.PTR); + } + /// /// Advertise a service profile. /// diff --git a/test/ServiceDiscoveryTest.cs b/test/ServiceDiscoveryTest.cs index 3933207..e23839d 100644 --- a/test/ServiceDiscoveryTest.cs +++ b/test/ServiceDiscoveryTest.cs @@ -165,7 +165,7 @@ public void Discover_ServiceInstance() mdns.NetworkInterfaceDiscovered += (s, e) => { - mdns.SendQuery(service.QualifiedServiceName, DnsClass.IN, DnsType.PTR); + sd.QueryServiceInstances(service.ServiceName); }; sd.ServiceInstanceDiscovered += (s, e) =>