Package javax.jmdns

Examples of javax.jmdns.ServiceInfo


  if (serviceEvent.getName().equalsIgnoreCase(name)) {
      return; // ignore my message
  }

  ServiceInfo info = serviceEvent.getInfo();
  String url = info.getNiceTextString();

  machineFactory.destroyRemoteMachine(url, id);
    }
View Full Code Here


  if (serviceEvent.getName().equalsIgnoreCase(name)) {
      return; // ignore this machine message
  }

  ServiceInfo info = serviceEvent.getDNS().getServiceInfo(MDNS_TYPE,
    serviceEvent.getName());
  String url = info.getNiceTextString();

  machineFactory.newRemoteMachine(url, id, isLocalhost);
    }
View Full Code Here

            this.jmdns = JmDNS.create(); // Maybe init with local loopback in case no other network card is present, otherwise returns null

            this.timeOfStartup = System.currentTimeMillis();

            final int port = getFreePort();
            final ServiceInfo service = ServiceInfo.create(TYPE, NAME + " @" + this.timeOfStartup, port, 0, 0, EXPORT_NAME);

            this.localManagerExportServer = Proxies.newServer(EXPORT_NAME, port, (DiscoveryManager) this.localManager);
            this.jmdns.registerService(service);

            // Set it again, this time for the lock below
View Full Code Here

            this.jmdns = JmDNS.create(); // Maybe init with local loopback in case no other network card is present, otherwise returns null

            this.timeOfStartup = System.currentTimeMillis();

            final int port = RemoteDiscoveryImpl.getFreePort();
            final ServiceInfo service = ServiceInfo.create(TYPE, NAME + " @" + this.timeOfStartup, port, 0, 0, EXPORT_NAME);
            this.logger.status("backgroundinit/export", "port", port);
            this.localManagerExportServer = Proxies.newServer(EXPORT_NAME, port, (DiscoveryManager) this.localTCPIPManager);
            this.logger.status("backgroundinit/announce", "port", port);
            this.jmdns.registerService(service);
View Full Code Here

            JmDNS jmdns = JmDNS.create();
            System.out.println("Opened JmDNS");
            System.out.println("\nPress r and Enter, to register HTML service 'foo'");
            int b;
            while ((b = System.in.read()) != -1 && (char) b != 'r');
            ServiceInfo info = ServiceInfo.create("_http._tcp.local.", "foo", 1268, 0, 0, "path=index.html");
            jmdns.registerService(info);
           
            System.out.println("\nRegistered Service as "+info);
            System.out.println("Press q and Enter, to quit");
            //int b;
View Full Code Here

     * Resolve a service.
     */
    public void serviceResolved(ServiceEvent event) {
        String name = event.getName();
        String type = event.getType();
        ServiceInfo info = event.getInfo();

        if (name.equals(serviceList.getSelectedValue())) {
            if (info == null) {
                this.info.setText("service not found");
            } else {
               
                StringBuffer buf = new StringBuffer();
                buf.append(name);
                buf.append('.');
                buf.append(type);
                buf.append('\n');
                buf.append(info.getServer());
                buf.append(':');
                buf.append(info.getPort());
                buf.append('\n');
                buf.append(info.getAddress());
                buf.append(':');
                buf.append(info.getPort());
                buf.append('\n');
                for (Enumeration names = info.getPropertyNames() ; names.hasMoreElements() ; ) {
                    String prop = (String)names.nextElement();
                    buf.append(prop);
                    buf.append('=');
                    buf.append(info.getPropertyString(prop));
                    buf.append('\n');
                }
               
                this.info.setText(buf.toString());
            }
View Full Code Here

                if (name == null) {
                    info.setText("");
                } else {
                    System.out.println(this+" valueChanged() type:"+type+" name:"+name);
                    System.out.flush();
                    ServiceInfo service = jmdns.getServiceInfo(type, name);
                    if (service == null) {
                        info.setText("service not found");
                    } else {
                        jmdns.requestServiceInfo(type, name);
                    }
View Full Code Here

        System.out.println("Create JmDNS " + port);
        JmDNS jmdns = JmDNS.create();

        System.out.println("Create");
        final ServiceInfo service = ServiceInfo.create("_httpx._tcp.local.", "Port@" + port, port, 0, 0, ":-)");
        System.out.println("Register");
        jmdns.registerService(service);

        for (int i = 0; i < 10; i++) {
            System.out.println("Query:");
View Full Code Here

    public static void main(String[] args) throws IOException {

        JmDNS jmdns = JmDNS.create();
        VanillaRmiServer<Object> newServer = Proxies.newServer("XXX", 12345, new Object());

        final ServiceInfo service = ServiceInfo.create(".jo", "asdkjsah", 12345, 0, 0, "asdjk");

        jmdns.registerService(service);

        System.out.println("1");
        newServer.close();
View Full Code Here

                Map<Fields, String> map = cachedInfo.getQualifiedNameMap();
                byte[] srvBytes = null;
                String server = "";
                DNSEntry serviceEntry = this.getCache().getDNSEntry(info.getQualifiedName(), DNSRecordType.TYPE_SRV, DNSRecordClass.CLASS_ANY);
                if (serviceEntry instanceof DNSRecord) {
                    ServiceInfo cachedServiceEntryInfo = ((DNSRecord) serviceEntry).getServiceInfo(persistent);
                    if (cachedServiceEntryInfo != null) {
                        cachedInfo = new ServiceInfoImpl(map, cachedServiceEntryInfo.getPort(), cachedServiceEntryInfo.getWeight(), cachedServiceEntryInfo.getPriority(), persistent, (byte[]) null);
                        srvBytes = cachedServiceEntryInfo.getTextBytes();
                        server = cachedServiceEntryInfo.getServer();
                    }
                }
                for (DNSEntry addressEntry : this.getCache().getDNSEntryList(server, DNSRecordType.TYPE_A, DNSRecordClass.CLASS_ANY)) {
                    if (addressEntry instanceof DNSRecord) {
                        ServiceInfo cachedAddressInfo = ((DNSRecord) addressEntry).getServiceInfo(persistent);
                        if (cachedAddressInfo != null) {
                            for (Inet4Address address : cachedAddressInfo.getInet4Addresses()) {
                                cachedInfo.addAddress(address);
                            }
                            cachedInfo._setText(cachedAddressInfo.getTextBytes());
                        }
                    }
                }
                for (DNSEntry addressEntry : this.getCache().getDNSEntryList(server, DNSRecordType.TYPE_AAAA, DNSRecordClass.CLASS_ANY)) {
                    if (addressEntry instanceof DNSRecord) {
                        ServiceInfo cachedAddressInfo = ((DNSRecord) addressEntry).getServiceInfo(persistent);
                        if (cachedAddressInfo != null) {
                            for (Inet6Address address : cachedAddressInfo.getInet6Addresses()) {
                                cachedInfo.addAddress(address);
                            }
                            cachedInfo._setText(cachedAddressInfo.getTextBytes());
                        }
                    }
                }
                DNSEntry textEntry = this.getCache().getDNSEntry(cachedInfo.getQualifiedName(), DNSRecordType.TYPE_TXT, DNSRecordClass.CLASS_ANY);
                if (textEntry instanceof DNSRecord) {
                    ServiceInfo cachedTextInfo = ((DNSRecord) textEntry).getServiceInfo(persistent);
                    if (cachedTextInfo != null) {
                        cachedInfo._setText(cachedTextInfo.getTextBytes());
                    }
                }
                if (cachedInfo.getTextBytes().length == 0) {
                    cachedInfo._setText(srvBytes);
                }
View Full Code Here

TOP

Related Classes of javax.jmdns.ServiceInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.