Hi Vitaly,
On 19/01/2021 19:01, Vitaly Davidovich wrote:
A few colleagues and I were trying to make sense of the
joinGroup(SocketAddress, NetworkInterface)
<https://github.com/openjdk/jdk/blob/05a764f4ffb8030d6b768f2d362c388e5aabd92d/src/java.base/share/classes/java/net/MulticastSocket.java#L382>
method. In particular:
* Why does this take a SocketAddress and then ignores the port
in the implementation? Any reason it doesn't take InetAddress,
which would make it clear the port is unnecessary? The
deprecated overload of joinGroup takes an InetAddress (and is
deprecated because it didn't allow specifying the network
interface).
That was an API mistake in Java 1.4. When DatagramChannel was
updated to support joining multicast groups (in Java 7) it was able
to get the parameters right.
Would it make sense to make a note of this aspect in joinGroup's javadoc?
FWIW, the API documentation has been clarified in 17 by
https://bugs.openjdk.java.net/browse/JDK-8237352
I hope this will make things clearer.
best regards,
-- daniel