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

Socket.getTrafficClass() is throwing SocketException under Win 2000

XMLWordPrintable

    • rc1
    • sparc
    • solaris_2.6
    • Verified



      Name: acR10002 Date: 11/01/2001


      java.net.Socket.getTrafficClass() permanently throws SocketException when an
      attempt is made to get traffic class for a socket under Windows 2000. The
      problem is similar to one described in 4511783, however this time
      getTrafficClass() works fine on Solaris, but throws an exception on Windows.
      This is illustrated by the following example:

      --------------- Test.java -----------
      import java.net.*;

      public class Test {

          public static void main(String args[]) {
              Socket soc = new Socket();
              try {
                  int tc = soc.getTrafficClass();
                  System.out.println(tc);
              } catch (SocketException e) {
                  e.printStackTrace(System.out);
              }
          }
      }
      -------------------------------------

      Output under Win2000:
      ------------------------------------
      >ver
      Microsoft Windows 2000 [Version 5.00.2195]

      >java -version
      java version "1.4.0-beta3"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta3-b84)
      Java HotSpot(TM) Client VM (build 1.4.0-beta3-b84, mixed mode)

      >java Test
      java.net.SocketException: Bad protocol option: getsockopt
      at java.net.PlainSocketImpl.socketGetOption(Native Method)
      at java.net.PlainSocketImpl.getOption(PlainSocketImpl.java:271)
      at java.net.Socket.getTrafficClass(Socket.java:1114)
      at Test.main(Test.java:9)

      ------------------------------------

      ======================================================================

            alanb Alan Bateman
            aycsunw Ayc Ayc (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: