The behavior of DatagramSocket / DatagramChannel send method when the target address is specified to port 0 appears to be system dependent:
on Linux / macOS: an IOException is thrown.
on Windows / Solaris: no exception is thrown.
Whether the spec and implementation should be changed to always throw IllegalArgumentException instead should be examined.
on Linux / macOS: an IOException is thrown.
on Windows / Solaris: no exception is thrown.
Whether the spec and implementation should be changed to always throw IllegalArgumentException instead should be examined.
- duplicates
-
JDK-8240533 Inconsistent Exceptions are thrown by DatagramSocket and DatagramChannel when sending a DatagramPacket to port 0.
- Closed
- relates to
-
JDK-8237571 java/net/DatagramSocket/SendCheck.java is failing on Solaris
- Resolved
-
JDK-8236105 Behaviors of DatagramSocket/DatagramChannel::socket send methods are not always consistent
- Resolved
-
JDK-8301457 Code in SendPortZero.java is uncommented even after JDK-8236852 was fixed
- Resolved