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

java.net.ServerSocket refuses connection if backlog = Integer.MAX_VALUE

XMLWordPrintable

    • 1.2.2
    • sparc
    • solaris_2.6



      Name: yyC67448 Date: 01/25/98



      The java.net.ServerSocket allways refuses connections on Solaris 2.6
      if backlog is set to Integer.MAX_VALUE

      Here is the test demonstrating the bug:

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

      class test
      {

        public static void main(String args[])
        {
          ServerSocket soc = null;
          Socket csoc = null;
          int port = 0;
       
          try {
            soc = new ServerSocket(port, Integer.MAX_VALUE);
            port = soc.getLocalPort();
          } catch(Exception e)
          {
            System.out.println("Failed. Unexpected exception:" + e);
            System.exit(-1);
          }
          
          try {
           csoc = new Socket(InetAddress.getLocalHost(), port);
          } catch(Exception e)
          {
            System.out.println("Failed. Unexpected exception:" + e);
            System.exit(-1);
          }

          try {
           soc.close();
           csoc.close();
          } catch(Exception e) {}
          System.out.println("Passed. OKAY");

        }
      }


      ------------------- Output from the test on Solaris 2.6 ------------------
      Failed. Unexpected exception:java.net.ConnectException: Connection refused
      ---------------------------------------------------------------------------
      ------------------- Output from the test on Solaris 2.4, 2.5.x ------------
      Passed. OKAY
      ---------------------------------------------------------------------------

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

            jdn Jeffrey Nisewanger (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: