A better alternative to join multicast groups is provided by the join methods defined in the MulticastChannel interface implemented by DatagramChannel.
The MulticastSocket API documentation should make the reader aware of that possibility.
The MulticastSocket API documentation should make the reader aware of that possibility.