Package java.net

Examples of java.net.MulticastSocket.joinGroup()


    MulticastSocket multicastSocket = null;

    try {
      multicastSocket = getNewMulticastSocket();
      InetAddress upnpAddress = getUPNPAddress();
      multicastSocket.joinGroup(upnpAddress);

      sendMessage(multicastSocket, "upnp:rootdevice", ALIVE);
      sendMessage(multicastSocket, PMS.get().usn(), ALIVE);
      sendMessage(multicastSocket, "urn:schemas-upnp-org:device:MediaServer:1", ALIVE);
      sendMessage(multicastSocket, "urn:schemas-upnp-org:service:ContentDirectory:1", ALIVE);
View Full Code Here


        MulticastSocket msocket = (MulticastSocket) socket;
       
        //log.info("Creating multicast socket on port: " + port + " on
        msocket.setLoopbackMode(loopbackMode);

        msocket.joinGroup(inetAddress);
    }

    protected DatagramSocket createSocket(int port) throws IOException {
        return new MulticastSocket(port);
    }
View Full Code Here

         while (nis.hasMoreElements()) {
            retval = new MulticastSocket(port);
            NetworkInterface networkInterface = nis.nextElement();
            retval.setNetworkInterface(networkInterface);
            try {
               retval.joinGroup(mcast_addr);
               String msg = "Successfully bind to " + networkInterface;
               okTrace.append(msg).append('\n');
            } catch (IOException e) {
               e.printStackTrace();
               String msg = "Failed to bind to " + networkInterface + ".";
View Full Code Here

         }
         s.setSoTimeout(timeout);
         s.setTimeToLive(ttl);
         if(log.isTraceEnabled())
            log.trace("TTL on multicast discovery socket is " + ttl);
         s.joinGroup(iaGroup);
         if (trace)
            log.trace("MulticastSocket: " + s);
         DatagramPacket packet;
         // Send a request optionally restricted to a cluster partition
         StringBuffer data = new StringBuffer("GET_ADDRESS");
View Full Code Here

                ms.setSoTimeout(0);
                ms.setTimeToLive(TTL);
                if (!ms.getBroadcast()) {
                    ms.setBroadcast(true);
                }
                ms.joinGroup(ia);

                list.add(ms);

                log.debug(String.format("Created MulticastSocket for '%1$s:%2$s' on network adapter: %3$s", ia.getHostName(), port, ni));
View Full Code Here

        final InetAddress inetAddress = InetAddress.getByName(host);

        final InetSocketAddress address = new InetSocketAddress(inetAddress, port);

        final MulticastSocket multicast = new MulticastSocket(port);
        multicast.joinGroup(inetAddress);

        if (options.has("reuse-address"))
            multicast.setReuseAddress(options.get("reuse-address", false));
        if (options.has("broadcast"))
            multicast.setBroadcast(options.get("broadcast", false));
View Full Code Here

                ms.setSoTimeout(0);
                ms.setTimeToLive(TTL);
                if (!ms.getBroadcast()) {
                    ms.setBroadcast(true);
                }
                ms.joinGroup(ia);

                list.add(ms);

            } catch (Throwable e) {
View Full Code Here

                ms.setSoTimeout(0);
                ms.setTimeToLive(TTL);
                if (!ms.getBroadcast()) {
                    ms.setBroadcast(true);
                }
                ms.joinGroup(ia);

                list.add(ms);

            } catch (Exception e) {
View Full Code Here

        MulticastSocket msocket = (MulticastSocket) socket;
       
        //log.info("Creating multicast socket on port: " + port + " on
        msocket.setLoopbackMode(loopbackMode);
        msocket.setTimeToLive(getTimeToLive());
        msocket.joinGroup(inetAddress);
    }

    protected DatagramSocket createSocket(int port) throws IOException {
        return new MulticastSocket(port);
    }
View Full Code Here

/*      */       }
/* 1452 */       s.setSoTimeout(timeout);
/* 1453 */       s.setTimeToLive(ttl);
/* 1454 */       if (log.isTraceEnabled())
/* 1455 */         log.trace("TTL on multicast discovery socket is " + ttl);
/* 1456 */       s.joinGroup(iaGroup);
/* 1457 */       if (trace) {
/* 1458 */         log.trace("MulticastSocket: " + s);
/*      */       }
/*      */
/* 1461 */       StringBuffer data = new StringBuffer("GET_ADDRESS");
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.