Because of some peculiarities on Mac the original Mac port brought
some code that attempts to determine the default network interface
( on Mac only ). In all cases, on recent OS and hardware, it now finds
the Apple peer-to-peer interface, awdl0, which is almost always the
wrong answer. This is fragile code, and using the more modern APIs
that support specifying an interface will avoid most of the problems,
but it is alas still used in many cases. A quick internet search shows
numerous reports of issues around this. We are also running into 
issues in internal testing.

It is possible for the heuristic to do a little better ( but not too much ),
by selecting an interface that supports both IPv4 and IPv6, rather
than just returning the first reasonable one it encounters. This will
better support the common case where a MulticastSocket, bound
to the wildcard address, tries to join a multicast group.

http://cr.openjdk.java.net/~chegar/defaultInterface/

Note: this it not a problem when joining a group using the joinGroup
method that accepts a NetworkInterface ( to join the group on ), or
using the new NIO MulticastChannel interface. The
MulticastSocket.joinGroup(InetAddress) are very much legacy, and
should probably be deprecated at some point in the near future. For
this issue I’d like to keep the changes as conservative as possible,
and possibly revisit this in 10.

-Chris.

Reply via email to