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

(dc) DatagramChannel issues with zero-length datagrams


    • Type: Bug
    • Status: In Progress
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 15
    • Fix Version/s: 16
    • Component/s: core-libs
    • Labels:


      DatagramChannel send/receive can be used to send and receive zero-length datagrams when the channel's socket is not connected. When connected there are several issues:

      1. The read methods return -1 rather than 0
      2. The send method and the write methods do nothing

      The API docs need to be updated to document the support for zero-length datagrams, including the API hazards that arise when the DatagramChannel is configured non-blocking (a return value of 0 is ambiguous).

      The updates to the API docs will include the changes to the read return value, track previously as JDK-8234756, so we can close that issue. In addition, the implementation changes address a residual issue with closing a channel around the time that a zero-length datagram is received so we can probably close JDK-8233198 too (JDK-8233198 was originally observed with the receive method but the implementation and should be limited to the read methods since JDK 14).


          Issue Links



              • Assignee:
                alanb Alan Bateman
                alanb Alan Bateman
              • Votes:
                0 Vote for this issue
                1 Start watching this issue


                • Created: