253 * Connects this channel's socket. |
253 * Connects this channel's socket. |
254 * |
254 * |
255 * <p> The channel's socket is configured so that it only receives |
255 * <p> The channel's socket is configured so that it only receives |
256 * datagrams from, and sends datagrams to, the given remote <i>peer</i> |
256 * datagrams from, and sends datagrams to, the given remote <i>peer</i> |
257 * address. Once connected, datagrams may not be received from or sent to |
257 * address. Once connected, datagrams may not be received from or sent to |
258 * any other address. A datagram socket remains connected until it is |
258 * any other address. Datagrams in the channel's {@linkplain |
259 * explicitly disconnected or until it is closed. |
259 * java.net.StandardSocketOptions#SO_RCVBUF socket receive buffer}, which |
|
260 * have not been {@linkplain #receive(ByteBuffer) received} before invoking |
|
261 * this method, may be discarded. The channel's socket remains connected |
|
262 * until it is explicitly disconnected or until it is closed. |
260 * |
263 * |
261 * <p> This method performs exactly the same security checks as the {@link |
264 * <p> This method performs exactly the same security checks as the {@link |
262 * java.net.DatagramSocket#connect connect} method of the {@link |
265 * java.net.DatagramSocket#connect connect} method of the {@link |
263 * java.net.DatagramSocket} class. That is, if a security manager has been |
266 * java.net.DatagramSocket} class. That is, if a security manager has been |
264 * installed then this method verifies that its {@link |
267 * installed then this method verifies that its {@link |
268 * remote address. Once connected, no further security checks are performed |
271 * remote address. Once connected, no further security checks are performed |
269 * for datagrams received from, or sent to, the given remote address. Care |
272 * 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 |
273 * should be taken to ensure that a connected datagram channel is not shared |
271 * with untrusted code. |
274 * with untrusted code. |
272 * |
275 * |
273 * <p> This method may be invoked at any time. It will not have any effect |
276 * <p> This method may be invoked at any time. If another thread has |
274 * on read or write operations that are already in progress at the moment |
277 * already initiated a read or write operation upon this channel, then an |
275 * that it is invoked. If this channel's socket is not bound then this method |
278 * invocation of this method will block until any such operation is |
276 * will first cause the socket to be bound to an address that is assigned |
279 * complete. If this channel's socket is not bound then this method will |
|
280 * first cause the socket to be bound to an address that is assigned |
277 * automatically, as if invoking the {@link #bind bind} method with a |
281 * automatically, as if invoking the {@link #bind bind} method with a |
278 * parameter of {@code null}. </p> |
282 * parameter of {@code null}. </p> |
279 * |
283 * |
280 * @param remote |
284 * @param remote |
281 * The remote address to which this channel is to be connected |
285 * The remote address to which this channel is to be connected |
282 * |
286 * |
283 * @return This datagram channel |
287 * @return This datagram channel |
321 * |
325 * |
322 * <p> The channel's socket is configured so that it can receive datagrams |
326 * <p> The channel's socket is configured so that it can receive datagrams |
323 * from, and sends datagrams to, any remote address so long as the security |
327 * from, and sends datagrams to, any remote address so long as the security |
324 * manager, if installed, permits it. |
328 * manager, if installed, permits it. |
325 * |
329 * |
326 * <p> This method may be invoked at any time. It will not have any effect |
330 * <p> This method may be invoked at any time. If another thread has |
327 * on read or write operations that are already in progress at the moment |
331 * already initiated a read or write operation upon this channel, then an |
328 * that it is invoked. |
332 * invocation of this method will block until any such operation is |
|
333 * complete. |
329 * |
334 * |
330 * <p> If this channel's socket is not connected, or if the channel is |
335 * <p> If this channel's socket is not connected, or if the channel is |
331 * closed, then invoking this method has no effect. </p> |
336 * closed, then invoking this method has no effect. </p> |
332 * |
337 * |
333 * @apiNote If this method throws an IOException, the channel's socket |
338 * @apiNote If this method throws an IOException, the channel's socket |