Powered by Ajaxy
Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Java: Join a multicast group via NetworkInterface

Java: Join a multicast group via NetworkInterface
{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 MulticastNetworkInterface
 {
  public static void main(String args[]) throws Exception
  {
      MulticastSocket ms = new MulticastSocket(6000);
      SocketAddress groupe_ip = new InetSocketAddress("224.2.2.4", 6555);
      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"));
          }
  }
}

Users who found this page were searching for:

  • python reading binary files
  • tkinter key release
  • python fully qualified hostname
  • python writelines
  • exit property of sys module

No comments yet.

Leave a Comment