JmDNS

Here's a code snippet in case you need to implement JmDNS , which supports the Apple Rendezvous service. This is useful in circumstances where you don't have a DNS server running but you need a way for your client pc's to discover your server.

 private void loadJmdns() throws IOException {<br />         // What site are we publishing?<br />         String file = Constants.ARCHIVE_PATH + &quot;publisher.xml&quot;;<br />         Publisher publisher = null;<br />         ResultSet rs;<br />         Long sitePublishId = null;<br />          String siteName = null;<br />         try {<br />             publisher = (Publisher) XmlUtils.getOne(file);<br />             sitePublishId = publisher.getSiteId();<br />           // if (!publisher.getSite().getSiteAlphaId().equals(&quot;MST&quot;)) {<br />                 // log.debug(&quot;sitePublishId: &quot; + sitePublishId );<br />                  Site site = (Site) DynaSiteObjects.getClinicMap().get(sitePublishId);<br />                 siteName = &quot;Zeprs&quot; + site.getAbbreviation();<br />                 JmDNS jmdns = new JmDNS();<br />                 ServiceInfo sinfo = new ServiceInfo(&quot;_http._tcp.local.&quot;, siteName, 8080, 0, 0, &quot;path=zeprs//home.do&quot;);<br />                 jmdns.registerService(sinfo);<br />                 log.debug(&quot;JmDNS service registered: &quot; + sinfo.getURL() + &quot; siteName: &quot; + siteName);<br />            //  }<br />         } catch (FileNotFoundException e) {<br />             // it's ok - file not created yet. Don't broadcast the service yet.<br />         }<br />     }
AttachmentSize
JmDmsListener.java_.txt1.7 KB