-
Bug
-
Resolution: Fixed
-
P4
-
8u40, 9, 12
-
b10
-
Verified
An issue with ServerSocketChannel::supportedOptions including the IP_TOS socket is reported here.
http://mail.openjdk.java.net/pipermail/nio-dev/2018-August/005365.html
It seems that the ServerSocketChannel has had partial support for IP_TOS since JDK 8u40 as a result of JDK- 8029607. The option can be set but cannot be read. The references to IP_TOS should be removed from ServerSocketChannelImpl.
The following test, maybe test/jdk/java/nio/channels/etc/PrintSupportedOptions.java demonstrates the issue:
/**
* @test
* @run PrintSupportedOptions
* @run main/othervm -Djava.net.preferIPv4Stack=true PrintSupportedOptions
*
import java.io.IOException;
import java.net.SocketOption;
import java.nio.channels.DatagramChannel;
import java.nio.channels.NetworkChannel;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
public class PrintSupportedOptions {
@FunctionalInterface
interface NetworkChannelSupplier<T extends NetworkChannel> {
T get() throws IOException;
}
public static void main(String[] args) throws IOException {
test(() -> SocketChannel.open());
test(() -> ServerSocketChannel.open());
test(() -> DatagramChannel.open());
}
static void test(NetworkChannelSupplier supplier) throws IOException {
try (NetworkChannel ch = supplier.get()) {
System.out.println(ch);
for (SocketOption<?> opt : ch.supportedOptions()) {
System.out.format(" %s -> %s%n", opt.name(), ch.getOption(opt));
}
}
}
}
http://mail.openjdk.java.net/pipermail/nio-dev/2018-August/005365.html
It seems that the ServerSocketChannel has had partial support for IP_TOS since JDK 8u40 as a result of JDK- 8029607. The option can be set but cannot be read. The references to IP_TOS should be removed from ServerSocketChannelImpl.
The following test, maybe test/jdk/java/nio/channels/etc/PrintSupportedOptions.java demonstrates the issue:
/**
* @test
* @run PrintSupportedOptions
* @run main/othervm -Djava.net.preferIPv4Stack=true PrintSupportedOptions
*
import java.io.IOException;
import java.net.SocketOption;
import java.nio.channels.DatagramChannel;
import java.nio.channels.NetworkChannel;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
public class PrintSupportedOptions {
@FunctionalInterface
interface NetworkChannelSupplier<T extends NetworkChannel> {
T get() throws IOException;
}
public static void main(String[] args) throws IOException {
test(() -> SocketChannel.open());
test(() -> ServerSocketChannel.open());
test(() -> DatagramChannel.open());
}
static void test(NetworkChannelSupplier supplier) throws IOException {
try (NetworkChannel ch = supplier.get()) {
System.out.println(ch);
for (SocketOption<?> opt : ch.supportedOptions()) {
System.out.format(" %s -> %s%n", opt.name(), ch.getOption(opt));
}
}
}
}
- relates to
-
JDK-8029607 Type of Service (TOS) cannot be set in IPv6 header
-
- Resolved
-