On Fri, 5 Dec 2008, Alan Bateman wrote:
For the specific problem at hand then I assume that running with -Djava.net.preferIPv4Stack=true fixes the problem.

Correct, though that option seems a bit of a misnomer, because it essentially completely disables IPv6 in Java.

More generally, it can be hard to develop a portable multicasting application. Typically, one binds to the wildcard address and then joins the multicast group. This is usually preferable because it is not possible to receive multicast datagrams on some systems when bound to a specific local address or a multicast address.

Yes, this is often sufficient with very simple apps, or where you run only one app on a host. But unfortunately often life is a bit more complex :-(

The issues with interference that you allude to on Linux are indeed a pain. I'm surprised there isn't a parameter or option to configure this behavior (Michael might want to jump in here as he was researching this specific topic a few months ago). 4701650 also touches on this topic.

You may already be aware of the Linux interference issues in depth, but let me add a couple of references for the record:

Linux netdev posting where in the followups there is extensive has discussion why it's implemented this way (different than in windows for example), and why it isn't changing:

http://marc.info/?l=linux-netdev&m=121579002105636&w=2

Bug #6579726 describes this "cross traffic" API issue on Linux. This has resulted in a number of bug/doc reports and workarounds in some Java programs:

http://www.jboss.org/community/docs/DOC-11710
http://www.jboss.org/community/docs/DOC-9469
https://jira.jboss.org/jira/browse/JGRP-777

As regards the suggestion to choose the protocol family at creation time - some of that is already in place for jdk7 as it was needed to add multicast support to NIO (and specifically because it is not portable to join IPv4 multicast groups with an IPv6 socket). When creating a DatagramChannel you can specify the protocol family and this should correspond to the address type of the multicast groups that you join. Classic networking needs a bit of work to allow mixing of IPv4 and IPv6 sockets in the same VM. Chris or Michael might want to say more about that.

It's great to hear there will be improvements in this area.

--
Pekka Savola                 "You each name yourselves king, yet the
Netcore Oy                    kingdom bleeds."
Systems. Networks. Security. -- George R.R. Martin: A Clash of Kings

Reply via email to