On Thu, 16 Feb 2023 18:54:05 GMT, Daniel Jeliński <djelin...@openjdk.org> wrote:

>> You and me both. As I wrote in the giant comment, I did a lot of 
>> experimenting. In the end, what I determined was that if the IGMPLevel 
>> (IPv4) or MldLevel (IPv6) is set to 0 (None), then attempting to join a 
>> multicast group throws an exception. So that seemed like a reasonable thing 
>> that supportsMulticast() could measure. Nothing else I tried, including the 
>> existing GetAdaptersAddresses approach, indicated that multicast was 
>> disabled in those situations.
>> 
>> Having said that, I'd be okay with ditching all of this code and just 
>> returning true unconditionally. It's unlikely that multicast would be 
>> disabled, and a single boolean isn't enough to express the actual setting 
>> anyway, since Windows apparently lets you disable receiving multicasts while 
>> still allowing you to send them.
>
> Ha! Apparently I have a machine where the implementation of 
> `supportsMulticast` implementation makes a difference. On my machine the test 
> `jdk/java/net/SocketOption/OptionsTest.java` is failing with:
> 
> java.net.SocketException: Invalid argument: no further information
>       at java.base/sun.nio.ch.Net.setInterface6(Native Method)
>       at 
> java.base/sun.nio.ch.DatagramChannelImpl.setOption(DatagramChannelImpl.java:377)
>       at 
> java.base/sun.nio.ch.DatagramSocketAdaptor.setOption(DatagramSocketAdaptor.java:431)
>       at java.base/java.net.DatagramSocket.setOption(DatagramSocket.java:1207)
>       at OptionsTest.test(OptionsTest.java:155)
>       at OptionsTest.doMulticastSocketTests(OptionsTest.java:235)
>       at OptionsTest.main(OptionsTest.java:337)
> ...
> 
> It works with the current master. Will try to figure it out.
> 
> BTW. did you try running jdk_net tests?

I ran the tests for NetworkInterface specifically, though that reminds me that 
I need to open a bug report about fixpath mangling things incorrectly. I'll 
give the full jdk_net suite a run and see what happens.

-------------

PR: https://git.openjdk.org/jdk/pull/12593

Reply via email to