United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7132679 (dc) DatagramChannel.send fails with ECONNREFUSED when not connected (Mac OSX)
JDK-7132679 : (dc) DatagramChannel.send fails with ECONNREFUSED when not connected (Mac OSX)

Details
Type:
Bug
Submit Date:
2012-01-24
Status:
Closed
Updated Date:
2012-03-28
Project Name:
JDK
Resolved Date:
2012-03-28
Component:
core-libs
OS:
os_x
Sub-Component:
java.nio
CPU:
x86
Priority:
P4
Resolution:
Fixed
Affected Versions:
7u4
Fixed Versions:
7u4 (b11)

Related Reports
Relates:

Sub Tasks

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.
                                     
2012-01-24



Hardware and Software, Engineered to Work Together