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

Connect should not throw BindException if the socket is bound

    XMLWordPrintable

    Details

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

      Description

      Noticed in JDK-8286372

      A call to Socket.connect may throw BindException even if the socket is already bound. Bind exception is documented as follows:
      "Signals that an error occurred while attempting to bind a socket to a local address and port. Typically, the port is in use, or the requested local address could not be assigned."
      Using BindException on an already-bound socket appears to be inappropriate.

      Internally, connect may return (WSA)EADDRINUSE on an unbound socket when the system is out of ephemeral ports, and on a bound socket when the combination of local and remote address is already in use, for example by a connection in TIME_WAIT state. The former case should still throw BindException, and the latter should be changed to throw ConnectException.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              djelinski Daniel Jelinski
              Reporter:
              djelinski Daniel Jelinski
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: