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

Linux 7.1 errors w/ Socket(InetAddress a, int p, InetAddress l, int lport)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.4.0
    • core-libs
    • None
    • beta2
    • generic
    • generic
    • Verified

      Linux 7.1 errors with Socket(InetAddress a, int p, InetAddress l, int lport)

      The above constructor does not work on Linux 7.1 (kernel 2.4.1). It will never
      select a local port in a test loop attempting to create a connection starting
      on local port 500 to infinity.

      For invalid ports 550 to 1023 it correctly throws a BindException.
      For valid ports above 1024, Linux 7.1 throws

            Socket Exception errno 22, error Invalid Argument for fd: 5.

      never selects a port, and the test keeps executing.

      Linux 6.2 executes correctly throwing the bind exception for ports
      under 1023, then stops at port 1024 and exits the test.

      excerpt from Test:


      try {
      System.out.println("testcase#3");
      InetAddress remote = InetAddress.getByName
      ("shorter.eng.sun.com");
      int remoteport = 13;
      InetAddress local = InetAddress.getLocalHost();
      int localport=550;
      Socket mysocket=null;

                  for (;;){
                      localport++;
      try {
                           mysocket = new Socket(remote, remoteport, local, localport);
      } catch ( Exception x) {
      System.out.println("localport = " + localport + x);
      continue;
      }
      break;
      }

              System.out.println("Localport = " +localport);

      [end]
      Full test file attached.

            alanb Alan Bateman
            kpolomsksunw Krystyna Polomski (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: