JDK-7132679 : (dc) DatagramChannel.send fails with ECONNREFUSED when not connected (Mac OSX)
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 7u4
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: os_x
  • CPU: x86
  • Submitted: 2012-01-24
  • Updated: 2012-03-28
  • Resolved: 2012-03-28
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 7
7u4 b11Fixed
Related Reports
Relates :  
Description
java.net.PortUnreachableException
at sun.nio.ch.DatagramChannelImpl.send0(Native Method)
at sun.nio.ch.DatagramChannelImpl.sendFromNativeBuffer(DatagramChannelImpl.java:512)
at sun.nio.ch.DatagramChannelImpl.send(DatagramChannelImpl.java:491)
at sun.nio.ch.DatagramChannelImpl.send(DatagramChannelImpl.java:455)

Build: b201
Tests failed (Regression):
java/nio/channels/DatagramChannel/SelectWhenRefused.java

Comments
EVALUATION I've changed the synopsis to reflect what this isssue is about. It seems that on MacOSX (10.6.8 at least) that send will fails with ECONNREFUSED for an unconnected UDP socket. This error should only be returned for the connected case. I notice that Apple's JDK6 does not fail in the same way so they may be a socket option or other means to disable this error when not connected.
24-01-2012