{filelink=9008}
import java.net.DatagramPacket;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.MulticastSocket;
import java.net.SocketAddress;
import java.net.NetworkInterface;
class Reseaux_Multicast
{
public static void main(String args[]) throws Exception
{
MulticastSocket ms = new MulticastSocket(6000);
SocketAddress groupe_ip = new InetSocketAddress("224.2.2.4", 6555);
// Le réseaux à joindre
NetworkInterface groupe_reseau = NetworkInterface .getByName("eth0");
if (groupe_reseau != null)
{
ms.joinGroup(groupe_ip, groupe_reseau);
}
else
{
ms.joinGroup(InetAddress.getByName("224.2.2.4"));
}
}
}