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 + "publisher.xml";<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("MST")) {<br /> // log.debug("sitePublishId: " + sitePublishId );<br /> Site site = (Site) DynaSiteObjects.getClinicMap().get(sitePublishId);<br /> siteName = "Zeprs" + site.getAbbreviation();<br /> JmDNS jmdns = new JmDNS();<br /> ServiceInfo sinfo = new ServiceInfo("_http._tcp.local.", siteName, 8080, 0, 0, "path=zeprs//home.do");<br /> jmdns.registerService(sinfo);<br /> log.debug("JmDNS service registered: " + sinfo.getURL() + " siteName: " + siteName);<br /> // }<br /> } catch (FileNotFoundException e) {<br /> // it's ok - file not created yet. Don't broadcast the service yet.<br /> }<br /> }
Attachment | Size |
---|---|
JmDmsListener.java_.txt | 1.7 KB |
- Printer-friendly version
- Login to post comments
- PDF version