|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.nio.channels.spi.AbstractInterruptibleChannel
java.nio.channels.SelectableChannel
java.nio.channels.spi.AbstractSelectableChannel
java.nio.channels.ServerSocketChannel
public abstract class ServerSocketChannel
A ServerSocketChannel is a partly abstracted stream-oriented listening socket
which is selectable. Binding and manipulation of socket options can only be done
through the associated ServerSocket object, returned by calling
socket method. ServerSocketChannels can not be constructed for a pre-existing
server socket, nor can it be assigned a SocketImpl.
A Server-Socket channel is open but not bound when created by
open method. (Calling accept before bound will cause a
NotYetBoundException). It can be bound by calling the bind method
of a related ServerSocket instance.
| Constructor Summary | |
|---|---|
protected |
ServerSocketChannel(SelectorProvider selectorProvider)
Construct a new instance for ServerSocketChannel |
| Method Summary | |
|---|---|
abstract SocketChannel |
accept()
Accepts a connection to this socket. |
static ServerSocketChannel |
open()
Create an open and unbound server-socket channel. |
abstract ServerSocket |
socket()
Return the related server-socket of this channel. |
int |
validOps()
Get the valid operations of this channel. |
| Methods inherited from class java.nio.channels.spi.AbstractSelectableChannel |
|---|
blockingLock, configureBlocking, implCloseChannel, implCloseSelectableChannel, implConfigureBlocking, isBlocking, isRegistered, keyFor, provider, register |
| Methods inherited from class java.nio.channels.SelectableChannel |
|---|
register |
| Methods inherited from class java.nio.channels.spi.AbstractInterruptibleChannel |
|---|
begin, close, end, isOpen |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.nio.channels.Channel |
|---|
close, isOpen |
| Constructor Detail |
|---|
protected ServerSocketChannel(SelectorProvider selectorProvider)
selectorProvider - An instance of SelectorProvider| Method Detail |
|---|
public static ServerSocketChannel open()
throws IOException
This channel is got by calling openServerSocketChannel
method of the default SelectorProvider instance.
IOException - If some IO problem occurs.public final int validOps()
SelectionKey.OP_ACCEPT.
validOps in class SelectableChannelSelectableChannel.validOps()public abstract ServerSocket socket()
ServerSocket.
public abstract SocketChannel accept()
throws IOException
It returns null when the channel is non-blocking and no connections available, otherwise it blocks indefinitely until a new connection is available or an I/O error occurs. The returned channel will be in blocking mode any way.
This method just execute the same security checks as the accept method of
the ServerSocket class.
ClosedChannelException - If the channel is already closed.
AsynchronousCloseException - If the channel is closed by another thread while this method
is in operation.
ClosedByInterruptException - If another thread interrupts the calling thread while the
operation is in progress. The calling thread will have the
interrupt state set, and the channel will be closed.
NotYetBoundException - If the socket has not yet been bound.
SecurityException - If there is a security manager, and the new connection is not
permitted to access.
IOException - Some other IO error occurred.
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||