Joining a Multicast Group : MulticastSocket « Network « Java Tutorial






import java.net.InetAddress;
import java.net.MulticastSocket;

public class Main {
  public static void main(String[] argv) throws Exception {

    String groupName = "groupName";
    int port = 1024;
    MulticastSocket msocket = new MulticastSocket(port);
    InetAddress group = InetAddress.getByName(groupName);
    msocket.joinGroup(group);

  }
}








19.22.MulticastSocket
19.22.1.Multicast Sender
19.22.2.Multicast Sniffer
19.22.3.Joining a Multicast Group
19.22.4.Receiving from a Multicast Group
19.22.5.Sending to a Multicast Group