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

DatagramSocket constructors accepting port number deserve to specify behavior for zero port passed

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 15
    • core-libs

      There are two DatagramSocket ctors accepting port number.
      One of them even has "The local port must be between 0 and 65535 inclusive" assertion.

      It turns out that "A port number of zero will let the system pick up an ephemeral port in a bind operation" - assertion from the InetSocketAddress constructor used by the implementation.

      Would be good for DatagramSocket ctors to specify that zero port number tells the system to pick any appropriate port number.

            pconcannon Patrick Concannon (Inactive)
            dbessono Dmitry Bessonov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: