A few questions/comments about java.net.MulticastSocket
Vitaly Davidovich
vitalyd at gmail.com
Tue Jan 19 18:36:00 UTC 2021
Hi all,
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).
- The MulticastSocket class javadoc still talks
<https://github.com/openjdk/jdk/blob/05a764f4ffb8030d6b768f2d362c388e5aabd92d/src/java.base/share/classes/java/net/MulticastSocket.java#L45>
about using joinGroup(InetAddress) as the way to join a group. Should
probably be updated to mention the non-deprecated overload.
- Also in the class javadoc, there's a "stray" port variable
<https://github.com/openjdk/jdk/blob/05a764f4ffb8030d6b768f2d362c388e5aabd92d/src/java.base/share/classes/java/net/MulticastSocket.java#L52>
that's not defined anywhere in the example. Since the port is ignored by
the joinGroup method, what is this port supposed to represent?
Does anyone have any insight into this?
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/net-dev/attachments/20210119/867bd984/attachment.htm>
More information about the net-dev
mailing list