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

ServerSocket behavior depends on platfrom and not work as its API doc. says.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 1.4.2_02
    • core-libs
    • generic
    • generic

      The constructor of ServerSocket does not work as its 1.4.2 API doc. says.

      --- ServerSocket document in 1.4.2 ---

      ...
      ServerSocket

      public ServerSocket(int port)
                   throws IOException

          Creates a server socket, bound to the specified port. A port of 0 creates
          a socket on any free port.
          The maximum queue length for incoming connection indications (a request
          to connect) is set to 50. If a connection indication arrives when the
          queue is full, the connection is refused.
          
      ....

      ----

      However, ServerSocket object seems accept more connections than the number of
      backlog which is specified when the boject is created.

      REPRODUCE:
        Please compile and execute the attached program in the following
        command line.
        
         % java backlog <host node name >
         
         
      BEHAVIOR:
        
        The behavior depends on platform.
        
        Solaris 8:
           The 5 connections are accepted, then Time out occurs.
           It took a few minute that
             "15 : java.net.ConnectException: Connection timed out" shows up
             
      4 : connect success
      20 : connect success
      11 : connect success
      14 : connect success
      3 : connect success
      15 : java.net.ConnectException: Connection timed out
      5 : java.net.ConnectException: Connection timed out
        
      .....


        RedHat linux 8:
           Similart to the Solaris 8 case.
           More connections than specified max backlog seems accepted.
           
      1 : connect success
      2 : connect success
      3 : connect success
      4 : connect success
      5 : connect success
      6 : connect success
      7 : connect success
      8 : connect success
      9 : connect success
      10 : connect success
      11 : connect success
      12 : connect success
      13 : connect success
      14 : connect success
      15 : connect success
      16 : connect success
      17 : java.net.ConnectException: Connection timed out
      18 : java.net.ConnectException: Connection timed out
      ...



        Windows 2000 Server :
           The program work as 1.4.2 API doc. says.
           
      4 : connect success
      16 : connect success
      14 : connect success
      13 : java.net.ConnectException: Connection refused: connect
      8 : java.net.ConnectException: Connection refused: connect
      ...
           
        
      REQUEST :
       
        Either of the following 2 options is requested.

        - To work the same behavior regardless to platform.
        - To state SocketServer Object behavior depends on each platform
        
        
      NOTE :
       
        I tried the test program in 1.5.0-beta-b28 both on Solaris8 and
        WindowsXP.
        The results was the same to the above-mentioned "BEHAVIOR",
        which is, the behavior depends on platform.
        
        List on Solaris8 :
        
         13 : connect success
         1 : connect success
         6 : connect success
         4 : connect success
         11 : connect success
         17 : java.net.ConnectException: Connection timed out
         5 : java.net.ConnectException: Connection timed out
         3 : java.net.ConnectException: Connection timed out
         24 : java.net.ConnectException: Connection timed out
         9 : java.net.ConnectException: Connection timed out
         ......
         
        List on WindowsXP:
        
         11 : connect success
         4 : connect success
         3 : connect success
         28 : java.net.ConnectException: Connection refused: connect
         27 : java.net.ConnectException: Connection refused: connect
         26 : java.net.ConnectException: Connection refused: connect
         25 : java.net.ConnectException: Connection refused: connect
         
         .....

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

            jccollet Jean-Christophe Collet (Inactive)
            tbaba Tadayuki Baba (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: