Skip to content

Commit

Permalink
feat(ServiceDiscovery): QueryServiceInstances
Browse files Browse the repository at this point in the history
  • Loading branch information
richardschneider committed Oct 12, 2018
1 parent edfe3c7 commit 54b43a6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
17 changes: 16 additions & 1 deletion src/ServiceDiscovery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,28 @@ public ServiceDiscovery(MulticastService mdns)
/// Asks other MDNS services to send their service names.
/// </summary>
/// <remarks>
/// When an answer is received, <see cref="ServiceDiscovered"/> is raised.
/// When an answer is received the <see cref="ServiceDiscovered"/> event is raised.
/// </remarks>
public void QueryAllServices()
{
Mdns.SendQuery(ServiceName, type: DnsType.PTR);
}

/// <summary>
/// Asks instances of the specified service to send details.
/// </summary>
/// <param name="service">
/// The service name to query. Typically of the form "_<i>service</i>._tcp".
/// </param>
/// <remarks>
/// When an answer is received the <see cref="ServiceInstanceDiscovered"/> event is raised.
/// </remarks>
/// <seealso cref="ServiceProfile.ServiceName"/>
public void QueryServiceInstances(string service)
{
Mdns.SendQuery(service + ".local", type: DnsType.PTR);
}

/// <summary>
/// Advertise a service profile.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion test/ServiceDiscoveryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
Expand Down

0 comments on commit 54b43a6

Please sign in to comment.