From 1d931e562ee2789e51d2a0d760655f0a12cd9c31 Mon Sep 17 00:00:00 2001 From: Steven Posick Date: Sat, 12 Sep 2015 12:35:38 -0400 Subject: [PATCH 1/2] Create gh-pages branch via GitHub --- index.html | 237 ++++++++++++++++++++++++++++++++ javascripts/scale.fix.js | 17 +++ params.json | 1 + stylesheets/github-light.css | 116 ++++++++++++++++ stylesheets/styles.css | 255 +++++++++++++++++++++++++++++++++++ 5 files changed, 626 insertions(+) create mode 100644 index.html create mode 100644 javascripts/scale.fix.js create mode 100644 params.json create mode 100644 stylesheets/github-light.css create mode 100644 stylesheets/styles.css diff --git a/index.html b/index.html new file mode 100644 index 0000000..a68976b --- /dev/null +++ b/index.html @@ -0,0 +1,237 @@ + + + + + + mdnsjava by posicks + + + + + + + +
+
+

mdnsjava

+

Multicast DNS (mDNS) [RFC 6762] & DNS-Based Service Discovery (DNS-SD) [RFC6763] in Java

+ +

View the Project on GitHub posicks/mdnsjava

+ + + +
+
+

+Multicast DNS (mDNS) & DNS-Based Service Discovery (DNS-SD) in Java

+ +

+Introduction

+ +

The Multicast DNS (mDNS) [RFC 6762] & DNS-Based Service Discovery (DNS-SD) [RFC 6763] in Java, mdnsjava for short, project is an extension of the dnsjava [dnsjava.org] project that implements Multicast DNS (mDNS) and DNS-Based Service Discovery (DNS-SD) in Java. mdnsjava does not artificially bind the mDNS and DNS-based Service Discovery functionality into a single combined API, instead, treating each as a separate function, independent from but related to the other. Thus, allowing clients to use Multicast DNS (mDNS) as a substitute for DNS and not just for service discovery.

+ +

+Features, Version 2.1.5

+ +
    +
  • Multicast DNS (mDNS) Responder
  • +
  • Multicast DNS (mDNS) Querier
  • +
  • Service Registration/Unregistration
  • +
  • Browsing for Services
  • +
  • Browsing for DNS/mDNS Resource Records
  • +
  • Resolving/Looking up Services synchronously and asynchronously
  • +
  • Resolving/Looking up DNS/mDNS Resource Records synchronously and asynchronously
  • +
  • Tested with dnsjava versions 2.1.4, 2.1.5, and 2.1.6.
  • +
+ +

+Dependencies

+ +

This project depends on:

+ +
    +
  • dnsjava.org project, version 2.1.5 or higher. (works version 2.1.4 and may work with early versions)
  • +
  • Java SE 1.5 or higher
  • +
+ +

+Command Line Tool Usage

+ +
$java -jar mdnsjava.jar dnssd
+
+Command Line:  dnssd <option> [parameters] 
+
+dnssd -E                         (Enumerate recommended registration domains)
+dnssd -F                             (Enumerate recommended browsing domains)
+dnssd -B        <Type> [<Domain>]             (Browse for services instances)
+dnssd -L <Name> <Type> [<Domain>]                (Look up a service instance)
+dnssd -R <Name> <Type> <Domain> <Port> <Host> [<TXT>...] (Register a service)
+dnssd -Q <FQDN> <rrtype> <rrclass>        (Generic query for any record type)
+dnssd -G v4/v6/v4v6 <Hostname>         (Get address information for hostname)
+dnssd -V           (Get version of currently running daemon / system service)
+$
+
+ +

+API Usage

+ +

Browse for Browse and Registration Domains using the default DNS search path

+ +
Resolve resolve = new Resolve(MulticastDNSService.DEFAULT_REGISTRATION_DOMAIN_NAME, 
+                              MulticastDNSService.REGISTRATION_DOMAIN_NAME,
+                              MulticastDNSService.DEFAULT_BROWSE_DOMAIN_NAME, 
+                              MulticastDNSService.BROWSE_DOMAIN_NAME, 
+                             `MulticastDNSService.LEGACY_BROWSE_DOMAIN_NAME);
+Domain[] domains = resolve.resolveDomains();
+for (Domain domain : domains)
+{
+    System.out.println(domain);
+}
+resolve.close();
+
+ +

Browsing for Services. Receiving events for each service discovered and removed

+ +
Browse browse = new Browse(serviceTypes);
+browse.start(new DNSSDListener()
+{
+    public void serviceDiscovered(Object id, ServiceInstance service)
+    {
+        System.out.println("Service Discovered - " + service);
+    }
+
+    public void serviceRemoved(Object id, ServiceInstance service)
+    {
+        System.out.println("Service Removed - " + service);
+    }
+
+    public void handleException(Object id, Exception e)
+    {
+        System.err.println("Exception: " + e.getMessage());
+        e.printStackTrace(System.err);
+    }
+});
+while (true)
+{
+    Thread.sleep(10);
+    if (System.in.read() == 'q')
+    {
+        break;
+    }
+}
+browse.close();
+
+ +

Resolve (Lookup) a Service, (one shot synchronously)

+ +
Resolve resolve = new Resolve("Test._mdc._tcp.local.");
+ServiceInstance[] services = resolve.resolveServices();
+for (ServiceInstance service : services)
+{
+    System.out.println(service);
+}
+
+ +

Resolve (Lookup) a Records, (one shot synchronously)

+ +
Resolve resolve = new Resolve("Test._mdc._tcp.local.", Type.ANY, DClass.IN);
+Record[] records = resolve.resolveRecords();
+for (Record record : records)
+{
+    System.out.println(records);
+}
+
+ +

Resolve (Lookup) a Records asynchronously, (one shot asynchronously)

+ +
Resolve resolve = new Resolve("Test._mdc._tcp.local.", Type.ANY, DClass.IN);
+Record[] records = resolve.resolveRecordsAsych(new RecordListener()
+{
+    public void receiveRecord(Object id, Record record)
+    {
+        System.out.println("Record Found - " + record);
+    }
+
+    public void handleException(Object id, Exception e)
+    {
+        System.err.println("Exception: " + e.getMessage());
+        e.printStackTrace(System.err);
+    }
+});
+Thread.sleep(1000);
+resolve.close();
+
+ +

Register and Unregister a Service + MulticastDNSService mDNSService = new MulticastDNSService(); + ServiceInstance service = new ServiceInstance(serviceName, 0, 0, port, hostname, MulticastDNSService.DEFAULT_SRV_TTL, addresses, txtValues); + ServiceInstance registeredService = mDNSService.register(service); + if (registeredService != null) + { + System.out.println("Services Successfully Registered: \n\t" + registeredService); + } else + { + System.err.println("Services Registration Failed!"); + } + while (true) + { + Thread.sleep(10); + if (System.in.read() == 'q') + { + if (mDNSService.unregister(registeredService)) + { + System.out.println("Services Successfully Unregistered: \n\t" + service); + } else + { + System.err.println("Services Unregistration Failed!"); + } + break; + } + } + mDNSService.close();

+ +

+Workaround for Java IPv6 Issues

+ +

Numerous bugs have been reported with Java's support of IPv6. Among them is an issue where the IP header's Time To Live (TTL) value for datagrams does not get set properly. If the IP header's Time To Live (TTL) value is not set to 255, then the Java VM must be started with IPv6 disabled, using the "-Djava.net.preferIPv4Stack=true" VM option. This is true for IPv4 datagrams as well. Disabling IPv6 fixes the TTL issue for IPv4.

+ +

For Example:

+ +
java -Djava.net.preferIPv4Stack=true -jar mdnsjava.jar dnssd -E
+
+ +

+Authors and Contributors

+ +

mdnsjava was created by Steve Posick (@posicks) as part of a Proof of Concept application for the Society of Motion Picture and Television Engineers (SMPTE) suite of standards on Media & Device Control over IP networks, [SMPTE ST2071]. The SMPTE ST2071 suite of standards defines an open standard for the representation of devices and services within an Internet of Things (IoT) using uniquely identified feature interfaces, similar in principle to uniquely identified Microservice interfaces, and defines extensions for the DNS-SD protocol that allow for the service discovery DNS infrastructure to be separated from the name resolution DNS infrastructure.

+ +

+Support or Contact

+ +

Having trouble with Pages? Check out our documentation or contact support.

+
+
+

This project is maintained by posicks

+

Hosted on GitHub Pages — Theme by orderedlist

+
+
+ + + + + + diff --git a/javascripts/scale.fix.js b/javascripts/scale.fix.js new file mode 100644 index 0000000..87a40ca --- /dev/null +++ b/javascripts/scale.fix.js @@ -0,0 +1,17 @@ +var metas = document.getElementsByTagName('meta'); +var i; +if (navigator.userAgent.match(/iPhone/i)) { + for (i=0; i [parameters] \r\n\r\n dnssd -E (Enumerate recommended registration domains)\r\n dnssd -F (Enumerate recommended browsing domains)\r\n dnssd -B [] (Browse for services instances)\r\n dnssd -L [] (Look up a service instance)\r\n dnssd -R [...] (Register a service)\r\n dnssd -Q (Generic query for any record type)\r\n dnssd -G v4/v6/v4v6 (Get address information for hostname)\r\n dnssd -V (Get version of currently running daemon / system service)\r\n $\r\n\r\n### API Usage\r\nBrowse for Browse and Registration Domains using the default DNS search path\r\n\r\n Resolve resolve = new Resolve(MulticastDNSService.DEFAULT_REGISTRATION_DOMAIN_NAME, \r\n MulticastDNSService.REGISTRATION_DOMAIN_NAME,\r\n MulticastDNSService.DEFAULT_BROWSE_DOMAIN_NAME, \r\n MulticastDNSService.BROWSE_DOMAIN_NAME, \r\n `MulticastDNSService.LEGACY_BROWSE_DOMAIN_NAME);\r\n Domain[] domains = resolve.resolveDomains();\r\n for (Domain domain : domains)\r\n {\r\n System.out.println(domain);\r\n }\r\n resolve.close();\r\n\r\nBrowsing for Services. Receiving events for each service discovered and removed\r\n\r\n Browse browse = new Browse(serviceTypes);\r\n browse.start(new DNSSDListener()\r\n {\r\n public void serviceDiscovered(Object id, ServiceInstance service)\r\n {\r\n System.out.println(\"Service Discovered - \" + service);\r\n }\r\n \r\n public void serviceRemoved(Object id, ServiceInstance service)\r\n {\r\n System.out.println(\"Service Removed - \" + service);\r\n }\r\n \r\n public void handleException(Object id, Exception e)\r\n {\r\n System.err.println(\"Exception: \" + e.getMessage());\r\n e.printStackTrace(System.err);\r\n }\r\n });\r\n while (true)\r\n {\r\n Thread.sleep(10);\r\n if (System.in.read() == 'q')\r\n {\r\n break;\r\n }\r\n }\r\n browse.close();\r\n\r\nResolve (Lookup) a Service, (one shot synchronously)\r\n\r\n Resolve resolve = new Resolve(\"Test._mdc._tcp.local.\");\r\n ServiceInstance[] services = resolve.resolveServices();\r\n for (ServiceInstance service : services)\r\n {\r\n System.out.println(service);\r\n }\r\n \r\nResolve (Lookup) a Records, (one shot synchronously)\r\n\r\n Resolve resolve = new Resolve(\"Test._mdc._tcp.local.\", Type.ANY, DClass.IN);\r\n Record[] records = resolve.resolveRecords();\r\n for (Record record : records)\r\n {\r\n System.out.println(records);\r\n }\r\n\r\nResolve (Lookup) a Records asynchronously, (one shot asynchronously)\r\n\r\n Resolve resolve = new Resolve(\"Test._mdc._tcp.local.\", Type.ANY, DClass.IN);\r\n Record[] records = resolve.resolveRecordsAsych(new RecordListener()\r\n {\r\n public void receiveRecord(Object id, Record record)\r\n {\r\n System.out.println(\"Record Found - \" + record);\r\n }\r\n \r\n public void handleException(Object id, Exception e)\r\n {\r\n System.err.println(\"Exception: \" + e.getMessage());\r\n e.printStackTrace(System.err);\r\n }\r\n });\r\n Thread.sleep(1000);\r\n resolve.close();\r\n\r\nRegister and Unregister a Service\r\n MulticastDNSService mDNSService = new MulticastDNSService();\r\n ServiceInstance service = new ServiceInstance(serviceName, 0, 0, port, hostname, MulticastDNSService.DEFAULT_SRV_TTL, addresses, txtValues);\r\n ServiceInstance registeredService = mDNSService.register(service);\r\n if (registeredService != null)\r\n {\r\n System.out.println(\"Services Successfully Registered: \\n\\t\" + registeredService);\r\n } else\r\n {\r\n System.err.println(\"Services Registration Failed!\");\r\n }\r\n while (true)\r\n {\r\n Thread.sleep(10);\r\n if (System.in.read() == 'q')\r\n {\r\n if (mDNSService.unregister(registeredService))\r\n {\r\n System.out.println(\"Services Successfully Unregistered: \\n\\t\" + service);\r\n } else\r\n {\r\n System.err.println(\"Services Unregistration Failed!\");\r\n }\r\n break;\r\n }\r\n }\r\n mDNSService.close();\r\n\r\n### Workaround for Java IPv6 Issues\r\nNumerous bugs have been reported with Java's support of IPv6. Among them is an issue where the IP header's Time To Live (TTL) value for datagrams does not get set properly. If the IP header's Time To Live (TTL) value is not set to 255, then the Java VM must be started with IPv6 disabled, using the \"-Djava.net.preferIPv4Stack=true\" VM option. This is true for IPv4 datagrams as well. Disabling IPv6 fixes the TTL issue for IPv4.\r\n\r\nFor Example:\r\n\r\n java -Djava.net.preferIPv4Stack=true -jar mdnsjava.jar dnssd -E\r\n\r\n### Authors and Contributors\r\nmdnsjava was created by Steve Posick (@posicks) as part of a Proof of Concept application for the Society of Motion Picture and Television Engineers ([SMPTE](http://www.smpte.org/)) suite of standards on Media & Device Control over IP networks, [[SMPTE ST2071](http://standards.smpte.org/search?fulltext=2071&smptes-status=in-force&submit=yes&content-group=smptes)]. The SMPTE ST2071 suite of standards defines an open standard for the representation of devices and services within an Internet of Things (IoT) using uniquely identified feature interfaces, similar in principle to uniquely identified Microservice interfaces, and defines extensions for the DNS-SD protocol that allow for the service discovery DNS infrastructure to be separated from the name resolution DNS infrastructure.\r\n\r\n### Support or Contact\r\nHaving trouble with Pages? Check out our documentation or [contact support](@posicks).","google":"UA-46703744-2","note":"Don't delete this file! It's used internally to help with page regeneration."} \ No newline at end of file diff --git a/stylesheets/github-light.css b/stylesheets/github-light.css new file mode 100644 index 0000000..872a6f4 --- /dev/null +++ b/stylesheets/github-light.css @@ -0,0 +1,116 @@ +/* + Copyright 2014 GitHub Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +.pl-c /* comment */ { + color: #969896; +} + +.pl-c1 /* constant, markup.raw, meta.diff.header, meta.module-reference, meta.property-name, support, support.constant, support.variable, variable.other.constant */, +.pl-s .pl-v /* string variable */ { + color: #0086b3; +} + +.pl-e /* entity */, +.pl-en /* entity.name */ { + color: #795da3; +} + +.pl-s .pl-s1 /* string source */, +.pl-smi /* storage.modifier.import, storage.modifier.package, storage.type.java, variable.other, variable.parameter.function */ { + color: #333; +} + +.pl-ent /* entity.name.tag */ { + color: #63a35c; +} + +.pl-k /* keyword, storage, storage.type */ { + color: #a71d5d; +} + +.pl-pds /* punctuation.definition.string, string.regexp.character-class */, +.pl-s /* string */, +.pl-s .pl-pse .pl-s1 /* string punctuation.section.embedded source */, +.pl-sr /* string.regexp */, +.pl-sr .pl-cce /* string.regexp constant.character.escape */, +.pl-sr .pl-sra /* string.regexp string.regexp.arbitrary-repitition */, +.pl-sr .pl-sre /* string.regexp source.ruby.embedded */ { + color: #183691; +} + +.pl-v /* variable */ { + color: #ed6a43; +} + +.pl-id /* invalid.deprecated */ { + color: #b52a1d; +} + +.pl-ii /* invalid.illegal */ { + background-color: #b52a1d; + color: #f8f8f8; +} + +.pl-sr .pl-cce /* string.regexp constant.character.escape */ { + color: #63a35c; + font-weight: bold; +} + +.pl-ml /* markup.list */ { + color: #693a17; +} + +.pl-mh /* markup.heading */, +.pl-mh .pl-en /* markup.heading entity.name */, +.pl-ms /* meta.separator */ { + color: #1d3e81; + font-weight: bold; +} + +.pl-mq /* markup.quote */ { + color: #008080; +} + +.pl-mi /* markup.italic */ { + color: #333; + font-style: italic; +} + +.pl-mb /* markup.bold */ { + color: #333; + font-weight: bold; +} + +.pl-md /* markup.deleted, meta.diff.header.from-file */ { + background-color: #ffecec; + color: #bd2c00; +} + +.pl-mi1 /* markup.inserted, meta.diff.header.to-file */ { + background-color: #eaffea; + color: #55a532; +} + +.pl-mdr /* meta.diff.range */ { + color: #795da3; + font-weight: bold; +} + +.pl-mo /* meta.output */ { + color: #1d3e81; +} + diff --git a/stylesheets/styles.css b/stylesheets/styles.css new file mode 100644 index 0000000..ff32137 --- /dev/null +++ b/stylesheets/styles.css @@ -0,0 +1,255 @@ +@import url(https://fonts.googleapis.com/css?family=Lato:300italic,700italic,300,700); + +body { + padding:50px; + font:14px/1.5 Lato, "Helvetica Neue", Helvetica, Arial, sans-serif; + color:#777; + font-weight:300; +} + +h1, h2, h3, h4, h5, h6 { + color:#222; + margin:0 0 20px; +} + +p, ul, ol, table, pre, dl { + margin:0 0 20px; +} + +h1, h2, h3 { + line-height:1.1; +} + +h1 { + font-size:28px; +} + +h2 { + color:#393939; +} + +h3, h4, h5, h6 { + color:#494949; +} + +a { + color:#39c; + font-weight:400; + text-decoration:none; +} + +a small { + font-size:11px; + color:#777; + margin-top:-0.6em; + display:block; +} + +.wrapper { + width:860px; + margin:0 auto; +} + +blockquote { + border-left:1px solid #e5e5e5; + margin:0; + padding:0 0 0 20px; + font-style:italic; +} + +code, pre { + font-family:Monaco, Bitstream Vera Sans Mono, Lucida Console, Terminal; + color:#333; + font-size:12px; +} + +pre { + padding:8px 15px; + background: #f8f8f8; + border-radius:5px; + border:1px solid #e5e5e5; + overflow-x: auto; +} + +table { + width:100%; + border-collapse:collapse; +} + +th, td { + text-align:left; + padding:5px 10px; + border-bottom:1px solid #e5e5e5; +} + +dt { + color:#444; + font-weight:700; +} + +th { + color:#444; +} + +img { + max-width:100%; +} + +header { + width:270px; + float:left; + position:fixed; +} + +header ul { + list-style:none; + height:40px; + + padding:0; + + background: #eee; + background: -moz-linear-gradient(top, #f8f8f8 0%, #dddddd 100%); + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(100%,#dddddd)); + background: -webkit-linear-gradient(top, #f8f8f8 0%,#dddddd 100%); + background: -o-linear-gradient(top, #f8f8f8 0%,#dddddd 100%); + background: -ms-linear-gradient(top, #f8f8f8 0%,#dddddd 100%); + background: linear-gradient(top, #f8f8f8 0%,#dddddd 100%); + + border-radius:5px; + border:1px solid #d2d2d2; + box-shadow:inset #fff 0 1px 0, inset rgba(0,0,0,0.03) 0 -1px 0; + width:270px; +} + +header li { + width:89px; + float:left; + border-right:1px solid #d2d2d2; + height:40px; +} + +header ul a { + line-height:1; + font-size:11px; + color:#999; + display:block; + text-align:center; + padding-top:6px; + height:40px; +} + +strong { + color:#222; + font-weight:700; +} + +header ul li + li { + width:88px; + border-left:1px solid #fff; +} + +header ul li + li + li { + border-right:none; + width:89px; +} + +header ul a strong { + font-size:14px; + display:block; + color:#222; +} + +section { + width:500px; + float:right; + padding-bottom:50px; +} + +small { + font-size:11px; +} + +hr { + border:0; + background:#e5e5e5; + height:1px; + margin:0 0 20px; +} + +footer { + width:270px; + float:left; + position:fixed; + bottom:50px; +} + +@media print, screen and (max-width: 960px) { + + div.wrapper { + width:auto; + margin:0; + } + + header, section, footer { + float:none; + position:static; + width:auto; + } + + header { + padding-right:320px; + } + + section { + border:1px solid #e5e5e5; + border-width:1px 0; + padding:20px 0; + margin:0 0 20px; + } + + header a small { + display:inline; + } + + header ul { + position:absolute; + right:50px; + top:52px; + } +} + +@media print, screen and (max-width: 720px) { + body { + word-wrap:break-word; + } + + header { + padding:0; + } + + header ul, header p.view { + position:static; + } + + pre, code { + word-wrap:normal; + } +} + +@media print, screen and (max-width: 480px) { + body { + padding:15px; + } + + header ul { + display:none; + } +} + +@media print { + body { + padding:0.4in; + font-size:12pt; + color:#444; + } +} From 5424d5413af7b8a9e05f45154977102b384726ec Mon Sep 17 00:00:00 2001 From: Steven Posick Date: Wed, 16 Dec 2015 20:09:50 -0500 Subject: [PATCH 2/2] Update index.html --- index.html | 180 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 114 insertions(+), 66 deletions(-) diff --git a/index.html b/index.html index a68976b..0fe9cd2 100644 --- a/index.html +++ b/index.html @@ -34,10 +34,11 @@

Introduction

-

The Multicast DNS (mDNS) [RFC 6762] & DNS-Based Service Discovery (DNS-SD) [RFC 6763] in Java, mdnsjava for short, project is an extension of the dnsjava [dnsjava.org] project that implements Multicast DNS (mDNS) and DNS-Based Service Discovery (DNS-SD) in Java. mdnsjava does not artificially bind the mDNS and DNS-based Service Discovery functionality into a single combined API, instead, treating each as a separate function, independent from but related to the other. Thus, allowing clients to use Multicast DNS (mDNS) as a substitute for DNS and not just for service discovery.

+

+The Multicast DNS (mDNS) [RFC 6762] & DNS-Based Service Discovery (DNS-SD) [RFC 6763] in Java (mdnsjava) project is an extension of dnsjava (dnsjava.org) that implements Multicast DNS (mDNS) [RFC 6762] and DNS-Based Service Discovery (DNS-SD) [RFC 6763] in Java (aka. Bonjour in Java). Unlike other mDNS/DNS-SD implementations mdnsjava does not artificially bind the mDNS and DNS-SD functionality into a single API, instead treating each as a separate feature that is independent from, but related to, the other. This allows clients to use Multicast DNS (mDNS) [RFC 6762] for name resolution without having to worry about service discovery and simplifies the use of DNS-Base Service Discovery using plain old Unicast DNS (mDNS can be used as a substitiute for DNS for name resolution and DNS can be used as a substitute for mDNS for service discovery).

-

-Features, Version 2.1.5

+

+Features

  • Multicast DNS (mDNS) Responder
  • @@ -47,23 +48,25 @@

  • Browsing for DNS/mDNS Resource Records
  • Resolving/Looking up Services synchronously and asynchronously
  • Resolving/Looking up DNS/mDNS Resource Records synchronously and asynchronously
  • -
  • Tested with dnsjava versions 2.1.4, 2.1.5, and 2.1.6.
  • +
  • Tested with dnsjava versions 2.1.4, 2.1.5, 2.1.6 and 2.1.7.
-

-Dependencies

+

+Dependencies

This project depends on:

    -
  • dnsjava.org project, version 2.1.5 or higher. (works version 2.1.4 and may work with early versions)
  • +
  • dnsjava.org project, version 2.1.5 or higher. (may work with early versions)
  • Java SE 1.5 or higher
-

-Command Line Tool Usage

+

+Command Line Tool Usage

-
$java -jar mdnsjava.jar dnssd
+
$java -jar mdnsjava.jar
+          or
+$java -cp mdnsjava.jar:dnsjava.jar dnssd
 
 Command Line:  dnssd <option> [parameters] 
 
@@ -81,36 +84,65 @@ 

API Usage

-

Browse for Browse and Registration Domains using the default DNS search path

+

The following are examples of mdnsjava API usage.

-
Resolve resolve = new Resolve(MulticastDNSService.DEFAULT_REGISTRATION_DOMAIN_NAME, 
-                              MulticastDNSService.REGISTRATION_DOMAIN_NAME,
-                              MulticastDNSService.DEFAULT_BROWSE_DOMAIN_NAME, 
-                              MulticastDNSService.BROWSE_DOMAIN_NAME, 
-                             `MulticastDNSService.LEGACY_BROWSE_DOMAIN_NAME);
-Domain[] domains = resolve.resolveDomains();
+

All domain names in mdnsjava are considered to be relative to the domain search path unless they end with a period ..

+

+For example: +

    +
  • The domain name posick.net. will be treated as an absolute domain name, looking up records in the posick.net domain.
  • +
  • The domain name posick.net will be treated as a relative domain name and will be prepended to each domain listed in the DNS search path, ex, posick.net.local., posick.net.posick.net., etc...
  • +

+ +

Lookup the registered Browse and Registration Domains [RFC 6263 Section 11] using the default DNS and mDNS search paths.

+ +
Lookup lookup = new Lookup(MulticastDNSService.DEFAULT_REGISTRATION_DOMAIN_NAME,
+                           MulticastDNSService.REGISTRATION_DOMAIN_NAME,
+                           MulticastDNSService.DEFAULT_BROWSE_DOMAIN_NAME,
+                           MulticastDNSService.BROWSE_DOMAIN_NAME,
+                           MulticastDNSService.LEGACY_BROWSE_DOMAIN_NAME);
+                               
+Domain[] domains = lookup.lookupDomains();
 for (Domain domain : domains)
 {
     System.out.println(domain);
 }
-resolve.close();
+lookup.close();
+
+ +

Lookup (Resolve) Services (one shot synchronous).

+ +
Lookup lookup = new Resolve("Test._org.smpte.st2071.service:service_v1.0._sub._mdc._tcp.local.");
+ServiceInstance[] services = lookup.lookupServices();
+for (ServiceInstance service : services)
+{
+    System.out.println(service);
+}
 
-

Browsing for Services. Receiving events for each service discovered and removed

+

Asynchronously Browse for Registered Services.

-
Browse browse = new Browse(serviceTypes);
+
String[] serviceTypes = new String[]
+{
+    "_http._tcp.",              // Web pages
+    "_printer._sub._http._tcp", // Printer configuration web pages
+    "_org.smpte.st2071.device:device_v1.0._sub._mdc._tcp",  // SMPTE ST2071 Devices
+    "_org.smpte.st2071.service:service_v1.0._sub._mdc._tcp"  // SMPTE ST2071 Services
+};
+
+Browse browse = new Browse(serviceTypes);
 browse.start(new DNSSDListener()
 {
     public void serviceDiscovered(Object id, ServiceInstance service)
     {
         System.out.println("Service Discovered - " + service);
     }
-
+                             
     public void serviceRemoved(Object id, ServiceInstance service)
     {
         System.out.println("Service Removed - " + service);
     }
-
+ 
     public void handleException(Object id, Exception e)
     {
         System.err.println("Exception: " + e.getMessage());
@@ -128,36 +160,26 @@ 

browse.close();

-

Resolve (Lookup) a Service, (one shot synchronously)

- -
Resolve resolve = new Resolve("Test._mdc._tcp.local.");
-ServiceInstance[] services = resolve.resolveServices();
-for (ServiceInstance service : services)
-{
-    System.out.println(service);
-}
-
- -

Resolve (Lookup) a Records, (one shot synchronously)

+

Lookup (Resolve) a Records Synchronously.

-
Resolve resolve = new Resolve("Test._mdc._tcp.local.", Type.ANY, DClass.IN);
-Record[] records = resolve.resolveRecords();
+
Lookup lookup = new Lookup("Test._mdc._tcp.local.", Type.ANY, DClass.IN);
+Record[] records = lookup.lookupRecords();
 for (Record record : records)
 {
     System.out.println(records);
 }
 
-

Resolve (Lookup) a Records asynchronously, (one shot asynchronously)

+

Lookup (Resolve) a Records Asynchronously.

-
Resolve resolve = new Resolve("Test._mdc._tcp.local.", Type.ANY, DClass.IN);
-Record[] records = resolve.resolveRecordsAsych(new RecordListener()
+
Lookup lookup = new Lookup("Test._mdc._tcp.local.", Type.ANY, DClass.IN);
+Record[] records = Lookup. LookupRecordsAsych(new RecordListener()
 {
     public void receiveRecord(Object id, Record record)
     {
         System.out.println("Record Found - " + record);
     }
-
+ 
     public void handleException(Object id, Exception e)
     {
         System.err.println("Exception: " + e.getMessage());
@@ -168,33 +190,37 @@ 

resolve.close();

-

Register and Unregister a Service - MulticastDNSService mDNSService = new MulticastDNSService(); - ServiceInstance service = new ServiceInstance(serviceName, 0, 0, port, hostname, MulticastDNSService.DEFAULT_SRV_TTL, addresses, txtValues); - ServiceInstance registeredService = mDNSService.register(service); - if (registeredService != null) - { - System.out.println("Services Successfully Registered: \n\t" + registeredService); - } else - { - System.err.println("Services Registration Failed!"); - } - while (true) +

Registering and Unregistering a Services.

+ +
MulticastDNSService mDNSService = new MulticastDNSService();
+ServiceInstance service = new ServiceInstance(serviceName, 0, 0, port, hostname, MulticastDNSService.DEFAULT_SRV_TTL, addresses, txtValues);
+ServiceInstance registeredService = mDNSService.register(service);
+if (registeredService != null)
+{
+    System.out.println("Services Successfully Registered: \n\t" + registeredService);
+} else
+{
+    System.err.println("Services Registration Failed!");
+}
+while (true)
+{
+    Thread.sleep(10);
+    if (System.in.read() == 'q')
     {
-        Thread.sleep(10);
-        if (System.in.read() == 'q')
+        if (mDNSService.unregister(registeredService))
+        {
+            System.out.println("Services Successfully Unregistered: \n\t" + service);
+        } else
         {
-            if (mDNSService.unregister(registeredService))
-            {
-                System.out.println("Services Successfully Unregistered: \n\t" + service);
-            } else
-            {
-                System.err.println("Services Unregistration Failed!");
-            }
-            break;
+            System.err.println("Services Unregistration Failed!");
         }
+        break;
     }
-    mDNSService.close();

+} +mDNSService.close(); +
+ +

Additional Information

Workaround for Java IPv6 Issues

@@ -206,13 +232,35 @@

java -Djava.net.preferIPv4Stack=true -jar mdnsjava.jar dnssd -E
 
-

-Authors and Contributors

+

DNS-based Service Dicovery (DNS-SD)

+ +

DNS-based Service Discovery is an efficient service discovery protocol developed by Apple, originally as Bonjour. DNS-SD is part of the [Zeroconf] specification and sclaes from the link-local network up to the Internet. Link-local network support is provided via mDNS using the local. domain name, while scaling to networks ouside than the link-local network is achieved thru Unicast DNS and regular domain names, for example posick.net..

+ +

SMPTE ST2071 Media & Device Control over IP

+ +

This project was originally created for the development of a proof of concept application for the Society of Motion Picture and Television Engineers (SMPTE) suite of standards on Media & Device Control over IP networks, [SMPTE ST2071]. The SMPTE ST2071 suite of standards defines an open standard for the representation of devices and services within an Internet of Things (IoT) and defines extensions to the DNS-SD protocol that allows for the service discovery DNS infrastructure to be seperate from the DNS infrastructure used for name resolution.

+ +

Registering and Unregistering ST2071 Capabilities

+ +

The SMPTE ST2071 standard defines Capabilities as uniquely identified interfaces that describe an atomic of behavior or feature. Devices and Services are then described by listing the identities of the uniquely identified interfaces. The standard defines the DNS naming convention for these Capabilities to be in the form:

+ +
'_' ${namespace} ':' ${interface_name} '_sub._mdc._tcp.' ${domain}
+
+ +

and for each device and service to also be registered using the DNS-SD name

+ +
'_mdc._tcp.' ${domain}
+
+ +

The registration of all services using the _mdc._tcp name facilitates the search of all registered ST2071 devices, services and Capability enpoints.

+ +

+Authors and Contributors

mdnsjava was created by Steve Posick (@posicks) as part of a Proof of Concept application for the Society of Motion Picture and Television Engineers (SMPTE) suite of standards on Media & Device Control over IP networks, [SMPTE ST2071]. The SMPTE ST2071 suite of standards defines an open standard for the representation of devices and services within an Internet of Things (IoT) using uniquely identified feature interfaces, similar in principle to uniquely identified Microservice interfaces, and defines extensions for the DNS-SD protocol that allow for the service discovery DNS infrastructure to be separated from the name resolution DNS infrastructure.

-

-Support or Contact

+

+Support or Contact

Having trouble with Pages? Check out our documentation or contact support.