< prev index next >

src/java.base/share/classes/java/net/DatagramSocket.java

Print this page
@@ -669,12 +669,17 @@
       * Receives a datagram packet from this socket. When this method
       * returns, the {@code DatagramPacket}'s buffer is filled with
       * the data received. The datagram packet also contains the sender's
       * IP address, and the port number on the sender's machine.
       * <p>
-      * This method blocks until a datagram is received. The
-      * {@code length} field of the datagram packet object contains
+      * This method blocks until a datagram is received.
+      * For the system-default socket implementation at least, if a
+      * {@linkplain Thread#isVirtual() virtual thread} blocked in {@code receive}
+      * is {@linkplain Thread#interrupt() interrupted} then the socket is closed
+      * and {@link SocketException} is thrown with the interrupt status set.
+      * <p>
+      * The {@code length} field of the datagram packet object contains
       * the length of the received message. If the message is longer than
       * the packet's length, the message is truncated.
       * <p>
       * If there is a security manager, and the socket is not currently
       * connected to a remote address, a packet cannot be received if the
< prev index next >