[jboss-user] [Remoting] - Re: binding multicast detector

bela@jboss.com do-not-reply at jboss.com
Sun Jul 16 04:23:59 EDT 2006


Okay, the following code below works:
package org.jgroups.tests;

import java.net.*;

/**
 * @author Bela Ban
 * @version $Id$
 */
public class bla
{
   public static void main(String[] args)
   {
      try
      {
         int port = Integer.parseInt(args[0]);
         InetAddress interfaceAddress = InetAddress.getByName(args[1]);
         NetworkInterface networkInterface = NetworkInterface.getByInetAddress(interfaceAddress);
         InetAddress multicastAddress = InetAddress.getByName(args[2]);
         System.out.println("port = " + port + "\ninterface address = " + interfaceAddress +
                            "\nnetwork interface = " + networkInterface + "\nmulticast address = " + multicastAddress);
          SocketAddress saddr;
          saddr=new InetSocketAddress(interfaceAddress, port);
         MulticastSocket socket = new MulticastSocket(saddr);
         socket.setInterface(interfaceAddress);
         socket.setNetworkInterface(networkInterface);
         socket.joinGroup(multicastAddress);

         Thread.sleep(600000);
      }
      catch (Exception e)
      {
         e.printStackTrace();
      }
   }
}

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3958314#3958314

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3958314



More information about the jboss-user mailing list