Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8209152

(so) ServerSocketChannel::supportedOptions includes IP_TOS

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 12
    • 8u40, 9, 12
    • core-libs
    • b10
    • Verified

    Description

      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));
                  }
              }
          }
      }

      Attachments

        Issue Links

          Activity

            People

              alanb Alan Bateman
              alanb Alan Bateman
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: