Examples of joinGroup()


Examples of java.net.MulticastSocket.joinGroup()

    MulticastSocket reqSock = new MulticastSocket();
    reqSock.send(request);
   
    // Wait for Response
    MulticastSocket resSock = new MulticastSocket(SERVICE_PORT);
    resSock.joinGroup(SERVICE_RESPONSE_IP);
   
    // 9 = # of bytes for an IP Address + 5 byte port
    DatagramPacket response = new DatagramPacket(new byte[9],9);
   
    // Receive
View Full Code Here

Examples of java.net.MulticastSocket.joinGroup()

    MulticastSocket reqSock = new MulticastSocket();
    reqSock.send(request);
   
    // Response Socket
    MulticastSocket resSock = new MulticastSocket(SERVICE_PORT);
    resSock.joinGroup(SERVICE_RESPONSE_IP);
   
    // 9 = # of bytes for an IP Address + 5 byte port
    DatagramPacket response = new DatagramPacket(new byte[9],9);
   
    // Set Socket Timeout
View Full Code Here

Examples of java.net.MulticastSocket.joinGroup()

         }
         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

Examples of java.net.MulticastSocket.joinGroup()

         }
         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

Examples of java.net.MulticastSocket.joinGroup()

            return existingKey;
        }

        boolean success = false;
        try {
            msocket.joinGroup(mcastaddr, interf);
            success = true;
            return newKey;
        } finally {
            if (!success) {
                mcastKeys.remove(newKey);
View Full Code Here

Examples of java.net.MulticastSocket.joinGroup()

                String multicastGroup = System.getProperty("hazelcast.multicast.group");
                if (multicastGroup == null) {
                    multicastGroup = multicastConfig.getMulticastGroup();
                }
                multicastConfig.setMulticastGroup(multicastGroup);
                multicastSocket.joinGroup(InetAddress.getByName(multicastGroup));
                multicastSocket.setSoTimeout(1000);
                mcService = new MulticastService(this, multicastSocket);
                mcService.addMulticastListener(new NodeMulticastListener(this));
            }
        } catch (Exception e) {
View Full Code Here

Examples of java.net.MulticastSocket.joinGroup()

        InetAddress inetAddress = InetAddress.getByName(host);

        InetSocketAddress address = new InetSocketAddress(inetAddress, port);

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

        if (ttl != null) {
            multicast.setTimeToLive(ttl);
        }
View Full Code Here

Examples of java.net.MulticastSocket.joinGroup()

                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

Examples of java.net.MulticastSocket.joinGroup()

            if (group != null)
            {
               MulticastSocket socket = new MulticastSocket(bindAddress);

               m_socket = socket;
               socket.joinGroup(group);
            }
            else if (bindAddress.getPort() <= 0)
            {
               DatagramChannel channel = DatagramChannel.open();
View Full Code Here

Examples of java.net.MulticastSocket.joinGroup()

        @Override
        public void run() {
            try (MulticastSocket s = new MulticastSocket(PORT)) {
                s.setLoopbackMode(false);
                s.joinGroup(INET_ADDRESS);
                DatagramPacket p = new DatagramPacket(new byte[4], 4);
                p.setAddress(INET_ADDRESS);
                p.setPort(PORT);
                while (run) {
                    s.receive(p);
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.