equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved. |
2 * Copyright 2000-2009 Sun Microsystems, Inc. All Rights Reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Sun designates this |
7 * published by the Free Software Foundation. Sun designates this |
28 import java.io.IOException; |
28 import java.io.IOException; |
29 import java.net.Socket; |
29 import java.net.Socket; |
30 import java.net.SocketOption; |
30 import java.net.SocketOption; |
31 import java.net.SocketAddress; |
31 import java.net.SocketAddress; |
32 import java.nio.ByteBuffer; |
32 import java.nio.ByteBuffer; |
33 import java.nio.channels.spi.*; |
33 import java.nio.channels.spi.AbstractSelectableChannel; |
|
34 import java.nio.channels.spi.SelectorProvider; |
34 |
35 |
35 /** |
36 /** |
36 * A selectable channel for stream-oriented connecting sockets. |
37 * A selectable channel for stream-oriented connecting sockets. |
37 * |
38 * |
38 * <p> A socket channel is created by invoking one of the {@link #open open} |
39 * <p> A socket channel is created by invoking one of the {@link #open open} |
210 |
211 |
211 // -- Socket-specific operations -- |
212 // -- Socket-specific operations -- |
212 |
213 |
213 /** |
214 /** |
214 * @throws ConnectionPendingException |
215 * @throws ConnectionPendingException |
215 * If a non-blocking connection operation is already in progress on |
216 * If a non-blocking connect operation is already in progress on |
216 * this channel |
217 * this channel |
217 * @throws AlreadyBoundException {@inheritDoc} |
218 * @throws AlreadyBoundException {@inheritDoc} |
218 * @throws UnsupportedAddressTypeException {@inheritDoc} |
219 * @throws UnsupportedAddressTypeException {@inheritDoc} |
219 * @throws ClosedChannelException {@inheritDoc} |
220 * @throws ClosedChannelException {@inheritDoc} |
220 * @throws IOException {@inheritDoc} |
221 * @throws IOException {@inheritDoc} |
224 @Override |
225 @Override |
225 public abstract SocketChannel bind(SocketAddress local) |
226 public abstract SocketChannel bind(SocketAddress local) |
226 throws IOException; |
227 throws IOException; |
227 |
228 |
228 /** |
229 /** |
|
230 * @throws UnsupportedOperationException {@inheritDoc} |
229 * @throws IllegalArgumentException {@inheritDoc} |
231 * @throws IllegalArgumentException {@inheritDoc} |
230 * @throws ClosedChannelException {@inheritDoc} |
232 * @throws ClosedChannelException {@inheritDoc} |
231 * @throws IOException {@inheritDoc} |
233 * @throws IOException {@inheritDoc} |
232 * |
234 * |
233 * @since 1.7 |
235 * @since 1.7 |
430 * |
432 * |
431 * <p> Where the channel is bound and connected to an Internet Protocol |
433 * <p> Where the channel is bound and connected to an Internet Protocol |
432 * socket address then the return value from this method is of type {@link |
434 * socket address then the return value from this method is of type {@link |
433 * java.net.InetSocketAddress}. |
435 * java.net.InetSocketAddress}. |
434 * |
436 * |
435 * @return The remote address; {@code null} if the channel is not {@link |
437 * @return The remote address; {@code null} if the channel's socket is not |
436 * #isOpen open} or the channel's socket is not connected |
438 * connected |
437 * |
439 * |
|
440 * @throws ClosedChannelException |
|
441 * If the channel is closed |
438 * @throws IOException |
442 * @throws IOException |
439 * If an I/O error occurs |
443 * If an I/O error occurs |
440 * |
444 * |
441 * @since 1.7 |
445 * @since 1.7 |
442 */ |
446 */ |
443 public abstract SocketAddress getConnectedAddress() throws IOException; |
447 public abstract SocketAddress getRemoteAddress() throws IOException; |
444 |
448 |
445 // -- ByteChannel operations -- |
449 // -- ByteChannel operations -- |
446 |
450 |
447 /** |
451 /** |
448 * @throws NotYetConnectedException |
452 * @throws NotYetConnectedException |