Skip to content
Permalink
Browse files
8244933: DatagramSocket.connect does not specify that it may cause da…
…tagrams in the socket receive buffer to be discarded

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
  • Loading branch information
pconcannon committed Jun 10, 2020
1 parent c4985fb commit 2e8356ea40903bbb4cf7353c19060da8ba731ab9
Showing 1 changed file with 8 additions and 2 deletions.
@@ -312,7 +312,10 @@ public void bind(SocketAddress addr) throws SocketException {
* operation, if the packet's address is set and the packet's address
* and the socket's address do not match, an {@code IllegalArgumentException}
* will be thrown. A socket connected to a multicast address may only
* be used to send packets.
* be used to send packets. Datagrams in the socket's {@linkplain
* java.net.StandardSocketOptions#SO_RCVBUF socket receive buffer}, which
* have not been {@linkplain #receive(DatagramPacket) received} before invoking
* this method, may be discarded.
*
* @param address the remote address for the socket
*
@@ -345,7 +348,10 @@ public void connect(InetAddress address, int port) {
* behaves as if invoking {@link #connect(InetAddress,int) connect(InetAddress,int)}
* with the given socket addresses IP address and port number, except that the
* {@code SocketException} that may be raised is not wrapped in an
* {@code UncheckedIOException}.
* {@code UncheckedIOException}. Datagrams in the socket's {@linkplain
* java.net.StandardSocketOptions#SO_RCVBUF socket receive buffer}, which
* have not been {@linkplain #receive(DatagramPacket) received} before invoking
* this method, may be discarded.
*
* @param addr The remote address.
*

0 comments on commit 2e8356e

Please sign in to comment.