Java: Unable to recieve multicast data
<p>I am trying to test a multicast client server application but my client is unable to receive any data. I read through the tutorials and cant find any way. Can you help me out here.</p>

<h2>   Client code</h2>

<pre><code>MulticastSocket socket = new MulticastSocket("9000");
socket.setInterface(InetAddress.getLocalHost());
socket.joinGroup("237.0.0.1");

while(true)
{
    byte ab[] = new byte[100];
    DatagramPacket packet = new DatagramPacket(ab, ab.length);
    socket.receive(packet);
    System.out.println("Got packet " + Arrays.toString(ab));
}
</code></pre>

<h2>Server Code</h2>

<pre><code>MulticastSocket socket = new MulticastSocket("9000");
socket.setInterface(InetAddress.getLocalHost());

socket.joinGroup("237.0.0.1");

byte index = 0;
while(true)
{
    byte[] bt = new byte[100];
    Arrays.fill(bt, (byte)index++);
    DatagramPacket packet = new DatagramPacket(bt, 100,"237.0.0.1", "9000");
    socket.send(packet);
    System.out.println("sent 100 bytes");
    Thread.sleep(10*1000);
}
</code></pre>

<hr>

<p>I am thinking the problem is with the way I am setting the interface.</p>

<p>Could someone help me out here and clear what am i missing to understand.</p>
