JDK-8231570 : (dc) Clarify implicit bind behavior of DatagramChannel
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 14
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2019-09-27
  • Updated: 2020-02-12
  • Resolved: 2019-10-25
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 14
14 b21Fixed
Related Reports
Blocks :  
CSR :  
Description
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.
Comments
URL: https://hg.openjdk.java.net/jdk/jdk/rev/1bd307ea5497 User: dfuchs Date: 2019-10-25 16:03:11 +0000
25-10-2019

The connect case described above was fixed by JDK-8231880
15-10-2019