This fix updates the javadoc for `DatagramSocket.connect` to inform the user that it may cause datagrams in the socket receive buffer to be discarded if not previously received via a call to `DatagramSocket.receive`.
Reviewed-by: alanb, dfuchs
This fix clarifies the behaviours of constructors from DatagramSocket and MulticastSocket when no address or a null address is supplied.
Reviewed-by: dfuchs
This fix updates the spec for DatagramSocket's constructors to inform the user of the Exceptions thrown when an invalid argument is passed.
Reviewed-by: dfuchs
Replace the underlying implementations of the java.net.DatagramSocket and java.net.MulticastSocket APIs with simpler and more modern implementations that are easy to maintain and debug.
Co-authored-by: Alan Bateman <alan.bateman@oracle.com>
Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com>
Co-authored-by: Daniel Fuchs <daniel.fuchs@oracle.com>
Reviewed-by: alanb, chegar, dfuchs
This fix adds a check for port == 0 to MulticastSocket's 2-arg send method to ensure a consistent exception is thrown across platforms
Reviewed-by: dfuchs
This fix changes the default port of a DatagramPacket from -1 to 0, which changes the behaviour of calling getSocketAddress with no port set from throwing an IAE to returning an InetSocketAddress representing any local address with port 0.
Reviewed-by: alanb, chegar, dfuchs
The solaris specific code is changed to use the fallback mechanism if the DLPI interface returns an error indicating that the operation is unsupported. In addition, NetworkInterface::getHardwareAddress is changed to always return null for the loopback interface.
Reviewed-by: alanb
DatagramSocket and MulticastSocket changed to throw IllegalArgumentException if not connected and passed a packet containing a port out of range
Reviewed-by: chegar, dfuchs
Methods from DatagramSocket and MulticastSocket added in JDK1.2 do not have their @since tags. This fix adds them in
Reviewed-by: alanb, chegar, dfuchs
Clarifies the behaviour of 2-arg joinGroup/leaveGroup methods when null is passed for the NetworkInteface argument. The fix also clarifies what is returned by getInterface() and getNetworkInterface() methods when no previous NetworkInterface has been set.
Reviewed-by: alanb, chegar, dfuchs
The MulticastSocket method getOption has been changed to conform to the behavior described in StandardSocketOptions.IP_MULTICAST_IF.
Reviewed-by: chegar, dfuchs
MulticastSocket.getOption(StandardSocketOption.IP_MULTICAST_LOOP) now returns true if loopback mode is enabled, and MulticastSocket.setOption(StandardSocketOption.IP_MULTICAST_LOOP, true) enables loopback mode. No other behavioral changes.
Reviewed-by: alanb, chegar
DatagramSocketImpl has a socket field that links back to the DatagramSocket. This is only used to figure out whether multicasting is supported or not. This fix replaces it with a boolean isMulticast.
Reviewed-by: alanb, chegar, dfuchs
DatagramSocket and MulticastSocket send methods are changed to throw IllegalArgumentException if no target address can be determined.
Reviewed-by: alanb
Update to API, to clarify that packets are dropped in the receive method of non-connected sockets if they fail the security manager checks
Reviewed-by: alanb, chegar, dfuchs