Show / Hide Table of Contents

Class ServiceDiscovery

DNS based Service Discovery is a way of using standard DNS programming interfaces, servers, and packet formats to browse the network for services.

Inheritance
Object
ServiceDiscovery
Implements
IDisposable
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: Makaretu.Dns
Assembly: Makaretu.Dns.Multicast.dll
Syntax
public class ServiceDiscovery : IDisposable

Constructors

| Improve this Doc View Source

ServiceDiscovery()

Creates a new instance of the ServiceDiscovery class.

Declaration
public ServiceDiscovery()
| Improve this Doc View Source

ServiceDiscovery(MulticastService)

Creates a new instance of the ServiceDiscovery class with the specified MulticastService.

Declaration
public ServiceDiscovery(MulticastService mdns)
Parameters
Type Name Description
MulticastService mdns

The underlaying MulticastService to use.

Fields

| Improve this Doc View Source

ServiceName

The service discovery service name.

Declaration
public static readonly DomainName ServiceName
Field Value
Type Description
DomainName

The service name used to enumerate other services.

Properties

| Improve this Doc View Source

AnswersContainsAdditionalRecords

Add the additional records into the answers.

Declaration
public bool AnswersContainsAdditionalRecords { get; set; }
Property Value
Type Description
Boolean

Defaults to false.

Remarks

Some malformed systems, such as js-ipfs and go-ipfs, only examine the Answers and not the AdditionalRecords. Setting this to true, will move the additional records into the answers.

This never done for DNS-SD answers.

| Improve this Doc View Source

Mdns

Gets the multicasting service.

Declaration
public MulticastService Mdns { get; }
Property Value
Type Description
MulticastService

Is used to send and recieve multicast Message.

| Improve this Doc View Source

NameServer

Gets the name server.

Declaration
public NameServer NameServer { get; }
Property Value
Type Description
NameServer

Is used to answer questions.

Methods

| Improve this Doc View Source

Advertise(ServiceProfile)

Advertise a service profile.

Declaration
public void Advertise(ServiceProfile service)
Parameters
Type Name Description
ServiceProfile service

The service profile.

Remarks

Any queries for the service or service instance will be answered with information from the profile.

Besides adding the profile's resource records to the Catalog PTR records are created to support DNS-SD and reverse address mapping (DNS address lookup).

| Improve this Doc View Source

Announce(ServiceProfile)

Sends an unsolicited MDNS response describing the service profile.

Declaration
public void Announce(ServiceProfile profile)
Parameters
Type Name Description
ServiceProfile profile

The profile to describe.

Remarks

Sends a MDNS response Message containing the pointer and resource records of the profile.

To provide increased robustness against packet loss, two unsolicited responses are sent one second apart.

| Improve this Doc View Source

Dispose()

Declaration
public void Dispose()
| Improve this Doc View Source

Dispose(Boolean)

Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type Name Description
Boolean disposing
| Improve this Doc View Source

QueryAllServices()

Asks other MDNS services to send their service names.

Declaration
public void QueryAllServices()
Remarks

When an answer is received the ServiceDiscovered event is raised.

| Improve this Doc View Source

QueryServiceInstances(DomainName)

Asks instances of the specified service to send details.

Declaration
public void QueryServiceInstances(DomainName service)
Parameters
Type Name Description
DomainName service

The service name to query. Typically of the form "_service._tcp".

Remarks

When an answer is received the ServiceInstanceDiscovered event is raised.

See Also
ServiceName
| Improve this Doc View Source

QueryServiceInstances(DomainName, String)

Asks instances of the specified service with the subtype to send details.

Declaration
public void QueryServiceInstances(DomainName service, string subtype)
Parameters
Type Name Description
DomainName service

The service name to query. Typically of the form "_service._tcp".

String subtype

The feature that is needed.

Remarks

When an answer is received the ServiceInstanceDiscovered event is raised.

See Also
ServiceName
| Improve this Doc View Source

QueryUnicastAllServices()

Asks other MDNS services to send their service names; accepts unicast and/or broadcast answers.

Declaration
public void QueryUnicastAllServices()
Remarks

When an answer is received the ServiceDiscovered event is raised.

| Improve this Doc View Source

QueryUnicastServiceInstances(DomainName)

Asks instances of the specified service to send details. accepts unicast and/or broadcast answers.

Declaration
public void QueryUnicastServiceInstances(DomainName service)
Parameters
Type Name Description
DomainName service

The service name to query. Typically of the form "_service._tcp".

Remarks

When an answer is received the ServiceInstanceDiscovered event is raised.

See Also
ServiceName
| Improve this Doc View Source

Unadvertise()

Sends a goodbye message for each anounced service.

Declaration
public void Unadvertise()
| Improve this Doc View Source

Unadvertise(ServiceProfile)

Sends a goodbye message for the provided profile and removes its pointer from the name sever.

Declaration
public void Unadvertise(ServiceProfile profile)
Parameters
Type Name Description
ServiceProfile profile

The profile to send a goodbye message for.

Events

| Improve this Doc View Source

ServiceDiscovered

Raised when a DNS-SD response is received.

Declaration
public event EventHandler<DomainName> ServiceDiscovered
Event Type
Type Description
EventHandler<DomainName>

Contains the service name.

Remarks

ServiceDiscovery passively monitors the network for any answers to a DNS-SD query. When an anwser is received this event is raised.

Use QueryAllServices() to initiate a DNS-SD question.

| Improve this Doc View Source

ServiceInstanceDiscovered

Raised when a servive instance is discovered.

Declaration
public event EventHandler<ServiceInstanceDiscoveryEventArgs> ServiceInstanceDiscovered
Event Type
Type Description
EventHandler<ServiceInstanceDiscoveryEventArgs>

Contains the service instance name.

Remarks

ServiceDiscovery passively monitors the network for any answers. When an answer containing a PTR to a service instance is received this event is raised.

| Improve this Doc View Source

ServiceInstanceShutdown

Raised when a servive instance is shutting down.

Declaration
public event EventHandler<ServiceInstanceShutdownEventArgs> ServiceInstanceShutdown
Event Type
Type Description
EventHandler<ServiceInstanceShutdownEventArgs>

Contains the service instance name.

Remarks

ServiceDiscovery passively monitors the network for any answers. When an answer containing a PTR to a service instance with a TTL of zero is received this event is raised.

Implements

System.IDisposable

See Also

RFC 6763 DNS-Based Service Discovery
  • Improve this Doc
  • View Source
Back to top Generated by DocFX