Commit 5528bcd 1 parent fbc50ec commit 5528bcd Copy full SHA for 5528bcd
File tree 3 files changed +42
-0
lines changed
3 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ service or service instance.
21
21
- Detects new and/or removed network interfaces
22
22
- Supports multicasting on multiple network interfaces
23
23
- Supports reverse address mapping
24
+ - Supports service subtypes (features)
24
25
- Handles legacy unicast queries, see #61
25
26
26
27
## Getting started
Original file line number Diff line number Diff line change
1
+ # Subtypes
2
+
3
+ Subtypes are used to define features implemented by a service instance. See
4
+ [ RFC 6763 - 7.1 Selective Instance Enumeration (Subtypes)] ( https://tools.ietf.org/html/rfc6763#section-7.1 ) for the details.
5
+
6
+
7
+ ## Finding service instances
8
+
9
+ [ QueryServiceInstances] ( xref:Makaretu.Dns.ServiceDiscovery.QueryServiceInstances* ) is used to find the
10
+ all the instances of a service with a specific feature.
11
+ The [ ServiceInstanceDiscovered] ( xref:Makaretu.Dns.ServiceDiscovery.ServiceInstanceDiscovered ) event is raised
12
+ each time a service instance is discovered.
13
+
14
+ ``` csharp
15
+ using Makaretu .Dns ;
16
+
17
+ var sd = new ServiceDiscovery ();
18
+ sd .ServiceInstanceDiscovered += (s , e ) =>
19
+ {
20
+ Console .WriteLine ($" service instance '{e .ServiceInstanceName }'" );
21
+ };
22
+ sd .QueryServiceInstances (" _myservice" , " apiv2" );
23
+ ```
24
+
25
+ ## Advertising
26
+
27
+ Create a [ ServiceProfile] ( xref:Makaretu.Dns.ServiceProfile ) with a feature
28
+ and then [ Advertise] ( xref:Makaretu.Dns.ServiceDiscovery.Advertise* ) it. Any queries for the service or
29
+ service instance will be answered with information from the profile.
30
+
31
+ ``` csharp
32
+ using Makaretu .Dns ;
33
+
34
+ var profile = new ServiceProfile (" x" , " _myservice._udp" , 1024 );
35
+ profile .Subtypes .Add (" apiv2" );
36
+ var sd = new ServiceDiscovery ();
37
+ sd .Advertise (profile );
38
+ ```
Original file line number Diff line number Diff line change 4
4
href : ms.md
5
5
- name : Service Discovery
6
6
href : sd.md
7
+ items :
8
+ - name : Subtypes
9
+ href : subtype.md
7
10
- name : Class Reference
8
11
href : ../api/Makaretu.Dns.yml
You can’t perform that action at this time.
0 commit comments