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

(dc) Clarify implicit bind behavior of DatagramChannel

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 14
    • 14
    • core-libs
    • b21

      Three methods of DatagramChannel, connect, send, and receive, may implicitly bind the channel, if not already bound. All three method descriptions contain the following statement in their specification:

       "If this channel's socket is not bound then this method will first cause the socket to be bound to an address that is assigned automatically, as if invoking the bind method with a parameter of null."

      In the DatagramChannel implementation:

      1) both send and receive effectively invoke the bind method as described. Bind may fail if the caller does not have the required permission ( the permission is granted by default, but there is still a security manager checkListen call, and the default permissions can be overridden ).

      2) the connect method does not invoke bind. It instead relies on the native connect in the kernel to perform the implicit bind.

            pconcannon Patrick Concannon (Inactive)
            chegar Chris Hegarty
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: