Examples of joinGroup()


Examples of java.net.MulticastSocket.joinGroup()

        String message = "Hello, world!";
        String longerMessage = message + " again.";
        String veryLongMessage = longerMessage + " Forever!";

        socket.joinGroup(group);
        socket.setSoTimeout(5000); // prevent eternal block in
                                   // socket.receive()
        // send & recieve packet
        byte[] sendData = message.getBytes();
        DatagramPacket sendDatagram = new DatagramPacket(sendData, 0,
View Full Code Here

Examples of java.net.MulticastSocket.joinGroup()

        MulticastSocket socket = null;
        try {
            // open a multicast socket
            socket = new MulticastSocket(PORT);
            socket.setLoopbackMode(false); // false indecates doing loop back
            socket.joinGroup(InetAddress.getByName(ADDRESS));

            // send the datagram
            byte[] sendData = message.getBytes();
            DatagramPacket sendDatagram = new DatagramPacket(sendData, 0,
                    sendData.length, new InetSocketAddress(InetAddress
View Full Code Here

Examples of java.net.MulticastSocket.joinGroup()

        if(local) {
            MulticastSocket send_sock=new MulticastSocket(PORT);
            send_sock.setTrafficClass(8);
            MulticastSocket recv_sock=new MulticastSocket(PORT);
            recv_sock.joinGroup(GROUP);
            recv_packet=new DatagramPacket(recv_buf, 0, recv_buf.length);
            for(int i=0; i < 10; i++) {
                start=System.currentTimeMillis();
                send_buf=Util.objectToByteBuffer(start);
                send_packet=new DatagramPacket(send_buf, 0, send_buf.length, GROUP, PORT);
View Full Code Here

Examples of java.net.MulticastSocket.joinGroup()

                Util.sleep(1000);
            }
        }
        else {
            MulticastSocket recv_sock=new MulticastSocket(PORT);
            recv_sock.joinGroup(GROUP);
            recv_packet=new DatagramPacket(recv_buf, 0, recv_buf.length);
            System.out.println("receiver started");
            for(;;) {
                recv_sock.receive(recv_packet);
                start=((Long)Util.objectFromByteBuffer(recv_buf, recv_packet.getOffset(), recv_packet.getLength())).longValue();
View Full Code Here

Examples of java.net.MulticastSocket.joinGroup()

                channel.connect(group_name);
            }
            else {
                group_addr=InetAddress.getByName("224.0.0.36");
                sock=new MulticastSocket(7777);
                sock.joinGroup(group_addr);
            }

            receiver=new Receiver(sock, channel, matrix, jg);
            receiver.start();
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);


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

Examples of java.net.MulticastSocket.joinGroup()

//    logger.trace("Multicast socket is on interface: "
//        + ssdpSocket.getInterface());
    ssdpSocket.setTimeToLive(32);
    // ssdpSocket.setLoopbackMode(true);
    this.upnpGroup = InetAddress.getByAddress(UPNP_HOST, UPNP_HOST_ADDRESS);
    ssdpSocket.joinGroup(this.upnpGroup);
    logger.trace("Socket Timeout: " + ssdpSocket.getSoTimeout());
    logger.trace("Socket TTL: " + ssdpSocket.getTimeToLive());

    return ssdpSocket;
  }
View Full Code Here

Examples of java.net.MulticastSocket.joinGroup()

                socket.setReuseAddress(true);
                socket.setReceiveBufferSize(64 * 1024);
                socket.setSendBufferSize(64 * 1024);
                socket.setTimeToLive(1);
                socket.bind(new InetSocketAddress(isa.getPort()));
                socket.joinGroup(isa.getAddress());
                mcast = socket;
                queue.execute(new MCastListener());
            } else {
               
                acceptor = new NioDatagramAcceptor();
View Full Code Here

Examples of java.net.MulticastSocket.joinGroup()

   
    try {
      pulseMonitorConsole.log("Thread: " + this.getName() + " - Joining Multicast Socket Group");
    MulticastSocket multiSocket = new MulticastSocket(broadcastSocket);
    InetAddress group = InetAddress.getByName("224.5.6.7");
    multiSocket.joinGroup(group);
    pulseMonitorConsole.log("Thread: " + this.getName() + " - Joined Multicast Socket Group");

    DatagramPacket packet;
//    for (int i = 0; i < 5; i++) {
    while(!closeDown) {
View Full Code Here

Examples of java.net.MulticastSocket.joinGroup()

            multicastSocket.setTimeToLive(ttl);

            // set the send interface
            InetAddress multicastInterface = networkService.resolvePublishHostAddress(address);
            multicastSocket.setInterface(multicastInterface);
            multicastSocket.joinGroup(InetAddress.getByName(group));

            multicastSocket.setReceiveBufferSize(bufferSize);
            multicastSocket.setSendBufferSize(bufferSize);
            multicastSocket.setSoTimeout(60000);
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.