ADDITIONAL SYSTEM INFORMATION :
OS=Windows_NT
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 94 Stepping 3, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=5e03
C:\Users\user>java -version
openjdk version "17.0.2" 2022-01-18
OpenJDK Runtime Environment (build 17.0.2+8-86)
OpenJDK 64-Bit Server VM (build 17.0.2+8-86, mixed mode, sharing)
A DESCRIPTION OF THE PROBLEM :
Error in method setNetworkInterface of MulticastSocket class when InetAddress is instance of Inet4Address, the error ocurrs when try set Net.setInterface6, in line 364 of DatagramChannelImpl class, but the InetAddress is not a instance of Inet6Address.
---------- BEGIN SOURCE ----------
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.*;
import java.io.IOException;
import java.net.InetAddress;
import java.net.MulticastSocket;
import java.net.NetworkInterface;
import org.junit.jupiter.api.Test;
class Test_MulticastSocket {
@Test
void test() {
String sourceIP = "192.168.55.1";
int pPort = 1418;
MulticastSocket s = null;
try {
s = new MulticastSocket(pPort);
InetAddress adrs = InetAddress.getByName(sourceIP);
NetworkInterface ntwIn = NetworkInterface.getByInetAddress(adrs);
s.setNetworkInterface(ntwIn);
assertTrue(true);
} catch (IOException e) {
if (s != null) {
s.close();
}
fail(e.getMessage());
}
}
}
---------- END SOURCE ----------
FREQUENCY : always