263 * java.net.DatagramSocket} class. That is, if a security manager has been |
263 * java.net.DatagramSocket} class. That is, if a security manager has been |
264 * installed then this method verifies that its {@link |
264 * installed then this method verifies that its {@link |
265 * java.lang.SecurityManager#checkAccept checkAccept} and {@link |
265 * java.lang.SecurityManager#checkAccept checkAccept} and {@link |
266 * java.lang.SecurityManager#checkConnect checkConnect} methods permit |
266 * java.lang.SecurityManager#checkConnect checkConnect} methods permit |
267 * datagrams to be received from and sent to, respectively, the given |
267 * datagrams to be received from and sent to, respectively, the given |
268 * remote address. |
268 * remote address. Once connected, no further security checks are performed |
|
269 * for datagrams received from, or sent to, the given remote address. Care |
|
270 * should be taken to ensure that a connected datagram channel is not shared |
|
271 * with untrusted code. |
269 * |
272 * |
270 * <p> This method may be invoked at any time. It will not have any effect |
273 * <p> This method may be invoked at any time. It will not have any effect |
271 * on read or write operations that are already in progress at the moment |
274 * on read or write operations that are already in progress at the moment |
272 * that it is invoked. If this channel's socket is not bound then this method |
275 * that it is invoked. If this channel's socket is not bound then this method |
273 * will first cause the socket to be bound to an address that is assigned |
276 * will first cause the socket to be bound to an address that is assigned |
367 * java.net.DatagramSocket#receive receive} method of the {@link |
370 * java.net.DatagramSocket#receive receive} method of the {@link |
368 * java.net.DatagramSocket} class. That is, if the socket is not connected |
371 * java.net.DatagramSocket} class. That is, if the socket is not connected |
369 * to a specific remote address and a security manager has been installed |
372 * to a specific remote address and a security manager has been installed |
370 * then for each datagram received this method verifies that the source's |
373 * then for each datagram received this method verifies that the source's |
371 * address and port number are permitted by the security manager's {@link |
374 * address and port number are permitted by the security manager's {@link |
372 * java.lang.SecurityManager#checkAccept checkAccept} method. The overhead |
375 * java.lang.SecurityManager#checkAccept checkAccept} method. Datagrams |
373 * of this security check can be avoided by first connecting the socket via |
376 * that are not permitted by the security manager are silently discarded. |
374 * the {@link #connect connect} method. |
377 * The overhead of this security check can be avoided by first connecting |
|
378 * the socket via the {@link #connect connect} method. |
375 * |
379 * |
376 * <p> This method may be invoked at any time. If another thread has |
380 * <p> This method may be invoked at any time. If another thread has |
377 * already initiated a read operation upon this channel, however, then an |
381 * already initiated a read operation upon this channel, however, then an |
378 * invocation of this method will block until the first operation is |
382 * invocation of this method will block until the first operation is |
379 * complete. If this channel's socket is not bound then this method will |
383 * complete. If this channel's socket is not bound then this method will |
398 * @throws ClosedByInterruptException |
402 * @throws ClosedByInterruptException |
399 * If another thread interrupts the current thread |
403 * If another thread interrupts the current thread |
400 * while the read operation is in progress, thereby |
404 * while the read operation is in progress, thereby |
401 * closing the channel and setting the current thread's |
405 * closing the channel and setting the current thread's |
402 * interrupt status |
406 * interrupt status |
403 * |
|
404 * @throws SecurityException |
|
405 * If a security manager has been installed |
|
406 * and it does not permit datagrams to be accepted |
|
407 * from the datagram's sender |
|
408 * |
407 * |
409 * @throws IOException |
408 * @throws IOException |
410 * If some other I/O error occurs |
409 * If some other I/O error occurs |
411 */ |
410 */ |
412 public abstract SocketAddress receive(ByteBuffer dst) throws IOException; |
411 public abstract SocketAddress receive(ByteBuffer dst) throws IOException; |