On one of our Windows machines (Windows Server 2022) the following error occurs :
java/net/DatagramSocket/DatagramSocketExample.java
java.net.SocketException: Invalid argument: setsockopt
at java.base/sun.nio.ch.Net.setInterface6(Native Method)
at java.base/sun.nio.ch.DatagramChannelImpl.setOption(DatagramChannelImpl.java:381)
at java.base/sun.nio.ch.DatagramSocketAdaptor.setOption(DatagramSocketAdaptor.java:379)
at java.base/java.net.DatagramSocket.setOption(DatagramSocket.java:1215)
at DatagramSocketExample.test(DatagramSocketExample.java:132)
at DatagramSocketExample.main(DatagramSocketExample.java:83)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
at java.base/java.lang.Thread.run(Thread.java:1575)
Same error pattern/similar exception can be seen in the following tests :
java/net/DatagramSocket/DatagramSocketExample.java
java/net/DatagramSocket/DatagramSocketMulticasting.java
java/net/MulticastSocket/JoinLeave.java
java/net/MulticastSocket/IPMulticastIF.java
java/net/MulticastSocket/NoSetNetworkInterface.java
java/net/MulticastSocket/SetGetNetworkInterfaceTest.java
java/net/SocketOption/OptionsTest.java
java/nio/channels/DatagramChannel/AdaptorMulticasting.java
java/nio/channels/DatagramChannel/Loopback.java
Seems the machine, "lost" Ipv6 interfaces, ipconfig does not show it any more (the machine and OS itself supports Ipv6 "in theory").
Looks like our checks in the test code do not cover this fully .