VansFannel
VansFannel

Reputation: 45911

java.io.IOException: Attempted to join a non-multicast group

I'm developing an Android 3.1 Tablet application.

It has a MulticastSocket:

public MulticastClient(String serverName, int port, Handler serviceHandler) throws IOException
{
    super(serverName);

    socket = new MulticastSocket(8888);
    InetAddress group = InetAddress.getByName("203.0.113.0");
    socket.joinGroup(group);

    this.mServiceHandler = serviceHandler; 
}

I get an error here:

InetAddress group = InetAddress.getByName("203.0.113.0");

This is the error:

java.io.IOException: Attempted to join a non-multicast group

How can I fix this error?

Upvotes: 1

Views: 1222

Answers (1)

Rawkode
Rawkode

Reputation: 22562

As stated here, multicast addresses have a strict and enforced range.

The multicast addresses are in the range 224.0.0.0 through 239.255.255.255.

Upvotes: 4

Related Questions