I want to check if a device can join a certain multicast group or not. I am using the code snippet below. The problem is I never got any exception even if the multicast group("239.253.0.1") is not available. It seems it can always join the group successfully and I can never catch any exception. When I use wireshark to capture the packets, however, there is no such igmp packets. Why?
try{
mcs = new MulticastSocket(1025);
group = InetAddress.getByName("239.253.0.1");
mcs.joinGroup(group);
Log.d(TAG,"join the group successfully"); //I can always get the successful msg
}catch(IOException e) {
e.printStackTrace();
} finally{
if(mcs != null) {
try{
mcs.leaveGroup(group);
mcs.close();
} catch(IOException e) {
e.printStackTrace();
}
}
}