ServiceInfo clientService = new ServiceInfo("_xmpp-client._tcp.local.", serverName + "._xmpp-client._tcp.local.", clientPortNum, "XMPP Server"); jmdns.registerService(clientService); ServiceInfo componentService = new ServiceInfo("_xmpp-component._tcp.local.", serverName + "._xmpp-component._tcp.local.", componentPortNum, "XMPP Component Server"); jmdns.registerService(componentService);
private void start(Collection serviceInfos) { state = DNSState.PROBING_1; incomingListener.start(); new Prober().start(); for (Iterator iterator = serviceInfos.iterator(); iterator.hasNext();) { try { registerService(new ServiceInfo((ServiceInfo) iterator.next())); } catch (Exception exception) { logger.log(Level.WARNING, "start() Registration exception ", exception); } } }
/** * Request service information. The information about the service is requested * and the ServiceListener.resolveService method is called as soon as it is available. * * @param type full qualified service type, such as <code>_http._tcp.local.</code> . * @param name unqualified service name, such as <code>foobar</code> . * @param timeout timeout in milliseconds */ public void requestServiceInfo(String type, String name, int timeout) { registerServiceType(type); ServiceInfo info = new ServiceInfo(type, name); new ServiceInfoResolver(info).start(); try { long end = System.currentTimeMillis() + timeout; long delay; synchronized (info) { while (!info.hasData() && (delay = end - System.currentTimeMillis()) > 0) { info.wait(delay); } } } catch (InterruptedException e) { // empty } }
ServiceInfo info = new ServiceInfo(type, name); new ServiceInfoResolver(info).start();
ServiceInfo clientService = new ServiceInfo("_xmpp-client._tcp.local.", serverName + "._xmpp-client._tcp.local.", clientPortNum, "XMPP Server"); jmdns.registerService(clientService); ServiceInfo componentService = new ServiceInfo("_xmpp-component._tcp.local.", serverName + "._xmpp-component._tcp.local.", componentPortNum, "XMPP Component Server"); jmdns.registerService(componentService);