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

(so) ServerSocketChannel::supportedOptions includes IP_TOS

    Details

    • Type: Bug
    • Status: In Progress
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 7, 12
    • Fix Version/s: tbd
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Understanding:
      Fix Understood

      Description

      A long standing bug with ServerSocketChannel::supportedOptions including IP_TOS 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 7. It can set the option but cannot read it. 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

          Activity

            People

            • Assignee:
              bpb Brian Burkhalter
              Reporter:
              alanb Alan Bateman
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: