Package javax.jmdns

Examples of javax.jmdns.JmDNS.addServiceListener()


          sinfo.getType());

        machineFactory.newRemoteMachine(url, id, false);
    }

    current.addServiceListener(MDNS_TYPE, this);

      } catch (IOException e) {
    e.printStackTrace();
    throw new RuntimeException(e);
      }
View Full Code Here


                jmdns.registerServiceType(argv[i]);
            }
        } else if ((argc == 1) && "-bt".equals(argv[0])) {
            jmdns.addServiceTypeListener(new SampleListener());
        } else if ((argc == 3) && "-bs".equals(argv[0])) {
            jmdns.addServiceListener(argv[1] + "." + argv[2], new SampleListener());
        } else if ((argc > 4) && "-rs".equals(argv[0])) {
            String type = argv[2] + "." + argv[3];
            String name = argv[1];
            Hashtable props = null;
            for (int i = 5 ; i < argc ; i++) {
View Full Code Here

            logger.addHandler(handler);
            logger.setLevel(Level.FINER);
            handler.setLevel(Level.FINER);
            */
            JmDNS jmdns = JmDNS.create();
            jmdns.addServiceListener("_http._tcp.local.", new SampleListener());
           
            System.out.println("Press q and Enter, to quit");
            int b;
            while ((b = System.in.read()) != -1 && (char) b != 'q');
            jmdns.close();
View Full Code Here

                            // Add Service Listeners
                            for (String type : serviceListeners.keySet()) {
                                List<ServiceListener> listeners = serviceListeners.get(type);
                                synchronized (listeners) {
                                    for (ServiceListener listener : listeners) {
                                        dns.addServiceListener(type, listener);
                                    }
                                }
                            }
                        }
                    });
View Full Code Here

            EasyMock.replay(serviceListenerMock);
            // EasyMock.makeThreadSafe(serviceListenerMock, false);

            registry = JmDNS.create();

            registry.addServiceListener(service.getType(), serviceListenerMock);

            registry.registerService(service);

            // We get the service added event when we register the service. However the service has not been resolved at this point.
            // The info associated with the event only has the minimum information i.e. name and type.
View Full Code Here

            serviceListenerMock.serviceAdded(capture(capServiceAddedEvent));
            serviceListenerMock.serviceResolved(capture(capServiceResolvedEvent));
            replay(serviceListenerMock);

            registry = JmDNS.create();
            registry.addServiceListener(service.getType(), serviceListenerMock);
            registry.registerService(service);

            // We get the service added event when we register the service. However the service has not been resolved at this point.
            // The info associated with the event only has the minimum information i.e. name and type.
            assertTrue("We did not get the service added event.", capServiceAddedEvent.hasCaptured());
View Full Code Here

                logger.setLevel(Level.FINER);
                handler.setLevel(Level.FINER);
            }

            final JmDNS jmdns = JmDNS.create();
            jmdns.addServiceListener("_http._tcp.local.", new SampleListener());

            System.out.println("Press q and Enter, to quit");
            int b;
            while ((b = System.in.read()) != -1 && (char) b != 'q') {
                /* Stub */
 
View Full Code Here

                jmdns.registerServiceType(argv[i]);
            }
        } else if ((argc == 1) && "-bt".equals(argv[0])) {
            jmdns.addServiceTypeListener(new SampleListener());
        } else if ((argc == 3) && "-bs".equals(argv[0])) {
            jmdns.addServiceListener(argv[1] + "." + argv[2], new SampleListener());
        } else if ((argc > 4) && "-rs".equals(argv[0])) {
            String type = argv[2] + "." + argv[3];
            String name = argv[1];
            Hashtable<String, Object> props = null;
            for (int i = 5; i < argc; i++) {
View Full Code Here

    @Override
    public void run() {
        try {
            final JmDNS jmdns = JmDNS.create();
            jmdns.addServiceListener(TOUCH_ABLE_TYPE, this);
            jmdns.addServiceListener(DACP_TYPE, this);

            final HashMap<String, String> values = new HashMap<String, String>();
            byte[] number = new byte[4];
            random.nextBytes(number);
View Full Code Here

    @Override
    public void run() {
        try {
            final JmDNS jmdns = JmDNS.create();
            jmdns.addServiceListener(TOUCH_ABLE_TYPE, this);
            jmdns.addServiceListener(DACP_TYPE, this);

            final HashMap<String, String> values = new HashMap<String, String>();
            byte[] number = new byte[4];
            random.nextBytes(number);
            values.put("DvNm", "Android-" + toHex(number));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.