Examples of joinGroup()


Examples of java.net.MulticastSocket.joinGroup()

    }

    protected DatagramSocket createSocket(URI uri, InetAddress inetAddress) throws IOException
    {
        MulticastSocket socket = new MulticastSocket(uri.getPort());
        socket.joinGroup(inetAddress);
        return socket;
    }

    protected Work createWork(DatagramPacket packet) throws IOException
    {
View Full Code Here

Examples of java.net.MulticastSocket.joinGroup()

    }

    protected DatagramSocket createSocket(int port, InetAddress inetAddress) throws IOException
    {
        MulticastSocket socket = new MulticastSocket(port);
        socket.joinGroup(inetAddress);
        return socket;
    }
}
View Full Code Here

Examples of java.net.MulticastSocket.joinGroup()

      try {
        InetAddress group = InetAddress
            .getByName(Properties.MultiCastGroupIP);
        MulticastSocket s = new MulticastSocket(
            Properties.MultiCastPort);
        s.joinGroup(group);
        DatagramPacket hi = new DatagramPacket(Key.getBytes(), Key
            .length(), group, Properties.MultiCastPort);
        s.send(hi);
        s.leaveGroup(group);
        s.close();
View Full Code Here

Examples of java.net.MulticastSocket.joinGroup()

        Thread receiver = new Thread() {
            public void run() {
                try {
                    MulticastSocket s = new MulticastSocket(port);
                    s.joinGroup(InetAddress.getByName(group));

                    // Create a DatagramPacket and do a receive
                    byte buf[] = new byte[1024];
                    DatagramPacket pack = new DatagramPacket(buf, buf.length);
                    s.receive(pack);
View Full Code Here

Examples of java.net.MulticastSocket.joinGroup()

 
  public void run(){
    MulticastSocket socket = null;
    try {
      socket = new MulticastSocket(port);
      socket.joinGroup(InetAddress.getByName(ip));
    } catch (IOException e1) {     
      e1.printStackTrace();
    }
   
    byte buffer[] = new byte[65507];
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()

  {
    try
    {
      MulticastSocket socket = new MulticastSocket(Constants.PORT_UDP);
      InetAddress group = InetAddress.getByName(Constants.GROUP_IP);
      socket.joinGroup(group);

      DatagramPacket packet;
      while (Globals.running)
      {
          byte[] buf = new byte[256];
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);

            } catch (final Exception e) {
View Full Code Here

Examples of java.net.MulticastSocket.joinGroup()

        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")) {
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
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.