public interface SocketChannel extends Channel
Channel.Channel.Unsafe| Modifier and Type | Method and Description |
|---|---|
io.netty.buffer.ByteBufAllocator |
alloc()
Return the assigned
ByteBufAllocator which will be used for allocate ByteBufs. |
ChannelFuture |
bind(SocketAddress localAddress)
Request to bind to the given
SocketAddress and notify the ChannelFuture once the operation
completes, either because the operation was successful or because of an error. |
ChannelFuture |
bind(SocketAddress localAddress,
ChannelPromise promise)
Request to bind to the given
SocketAddress and notify the ChannelFuture once the operation
completes, either because the operation was successful or because of an error. |
ChannelFuture |
close()
Request to close this ChannelOutboundInvoker and notify the
ChannelFuture once the operation completes,
either because the operation was successful or because of
an error. |
ChannelFuture |
close(ChannelPromise promise)
Request to close this ChannelOutboundInvoker and notify the
ChannelFuture once the operation completes,
either because the operation was successful or because of
an error. |
SocketChannelConfig |
config()
Returns the configuration of this channel.
|
ChannelFuture |
connect(SocketAddress remoteAddress)
Request to connect to the given
SocketAddress and notify the ChannelFuture once the operation
completes, either because the operation was successful or because of an error. |
ChannelFuture |
connect(SocketAddress remoteAddress,
ChannelPromise promise)
Request to connect to the given
SocketAddress and notify the ChannelFuture once the operation
completes, either because the operation was successful or because of an error. |
ChannelFuture |
connect(SocketAddress remoteAddress,
SocketAddress localAddress)
Request to connect to the given
SocketAddress while bind to the localAddress and notify the
ChannelFuture once the operation completes, either because the operation was successful or because of
an error. |
ChannelFuture |
connect(SocketAddress remoteAddress,
SocketAddress localAddress,
ChannelPromise promise)
Request to connect to the given
SocketAddress while bind to the localAddress and notify the
ChannelFuture once the operation completes, either because the operation was successful or because of
an error. |
ChannelFuture |
deregister()
Request to deregister this ChannelOutboundInvoker from the previous assigned
EventExecutor and notify the
ChannelFuture once the operation completes, either because the operation was successful or because of
an error. |
ChannelFuture |
deregister(ChannelPromise promise)
Request to deregister this ChannelOutboundInvoker from the previous assigned
EventExecutor and notify the
ChannelFuture once the operation completes, either because the operation was successful or because of
an error. |
ChannelFuture |
disconnect()
Request to discconect from the remote peer and notify the
ChannelFuture once the operation completes,
either because the operation was successful or because of an error. |
ChannelFuture |
disconnect(ChannelPromise promise)
Request to discconect from the remote peer and notify the
ChannelFuture once the operation completes,
either because the operation was successful or because of an error. |
boolean |
isInputShutdown()
Returns
true if and only if the remote peer shut down its output so that no more
data is received from this channel. |
boolean |
isOutputShutdown() |
InetSocketAddress |
localAddress()
Returns the local address where this channel is bound to.
|
ChannelFuture |
newFailedFuture(Throwable cause)
Create a new
ChannelFuture which is marked as fakued already. |
ChannelProgressivePromise |
newProgressivePromise()
Return an new
ChannelProgressivePromise |
ChannelPromise |
newPromise()
Return a new
ChannelPromise. |
ChannelFuture |
newSucceededFuture()
Create a new
ChannelFuture which is marked as successes already. |
ServerSocketChannel |
parent()
Returns the parent of this channel.
|
ChannelPipeline |
pipeline()
Return the assigned
ChannelPipeline |
void |
read()
Request to Read data from the
Channel into the first inbound buffer, triggers an
ChannelInboundHandler.messageReceived(ChannelHandlerContext, MessageList) event if data was
read, and triggers an
channelReadSuspended event so the
handler can decide to continue reading. |
InetSocketAddress |
remoteAddress()
Returns the remote address where this channel is connected to.
|
ChannelFuture |
shutdownOutput() |
ChannelFuture |
shutdownOutput(ChannelPromise future) |
ChannelPromise |
voidPromise()
Return a special ChannelPromise which can be reused for different operations.
|
ChannelFuture |
write(MessageList<?> msgs) |
ChannelFuture |
write(MessageList<?> msgs,
ChannelPromise promise) |
ChannelFuture |
write(Object msg)
Request to write a message via this ChannelOutboundInvoker and notify the
ChannelFuture
once the operation completes, either because the operation was successful or because of an error. |
ChannelFuture |
write(Object msg,
ChannelPromise promise)
Request to write a message via this ChannelOutboundInvoker and notify the
ChannelFuture
once the operation completes, either because the operation was successful or because of an error. |
closeFuture, eventLoop, id, isActive, isOpen, isRegistered, isWritable, metadata, unsafecompareToServerSocketChannel parent()
ChannelSocketChannelConfig config()
ChannelInetSocketAddress localAddress()
ChannelSocketAddress is supposed to be down-cast into more concrete
type such as InetSocketAddress to retrieve the detailed
information.localAddress in interface Channelnull if this channel is not bound.InetSocketAddress remoteAddress()
ChannelSocketAddress is supposed to be down-cast into more
concrete type such as InetSocketAddress to retrieve the detailed
information.remoteAddress in interface Channelnull if this channel is not connected.
If this channel is not connected but it can receive messages
from arbitrary remote addresses (e.g. DatagramChannel,
use DefaultAddressedEnvelope.recipient() to determine
the origination of the received message as this method will
return null.boolean isInputShutdown()
true if and only if the remote peer shut down its output so that no more
data is received from this channel. Note that the semantic of this method is different from
that of Socket.shutdownInput() and Socket.isInputShutdown().boolean isOutputShutdown()
Socket.isOutputShutdown()ChannelFuture shutdownOutput()
Socket.shutdownOutput()ChannelFuture shutdownOutput(ChannelPromise future)
ChannelFuture bind(SocketAddress localAddress)
SocketAddress and notify the ChannelFuture once the operation
completes, either because the operation was successful or because of an error.
This will result in having the
ChannelOutboundHandler.bind(ChannelHandlerContext, SocketAddress, ChannelPromise) method
called of the next ChannelOutboundHandler contained in the ChannelPipeline of the
Channel.
ChannelFuture connect(SocketAddress remoteAddress)
SocketAddress and notify the ChannelFuture once the operation
completes, either because the operation was successful or because of an error.
If the connection fails because of a connection timeout, the ChannelFuture will get failed with
a ConnectTimeoutException. If it fails because of connection refused a ConnectException
will be used.
This will result in having the
ChannelOutboundHandler.connect(ChannelHandlerContext, SocketAddress, SocketAddress, ChannelPromise)
method called of the next ChannelOutboundHandler contained in the ChannelPipeline of the
Channel.
ChannelFuture connect(SocketAddress remoteAddress, SocketAddress localAddress)
SocketAddress while bind to the localAddress and notify the
ChannelFuture once the operation completes, either because the operation was successful or because of
an error.
This will result in having the
ChannelOutboundHandler.connect(ChannelHandlerContext, SocketAddress, SocketAddress, ChannelPromise)
method called of the next ChannelOutboundHandler contained in the ChannelPipeline of the
Channel.
ChannelFuture disconnect()
ChannelFuture once the operation completes,
either because the operation was successful or because of an error.
This will result in having the
ChannelOutboundHandler.disconnect(ChannelHandlerContext, ChannelPromise)
method called of the next ChannelOutboundHandler contained in the ChannelPipeline of the
Channel.
ChannelFuture close()
ChannelFuture once the operation completes,
either because the operation was successful or because of
an error.
After it is closed it is not possible to reuse it again.
This will result in having the
ChannelOutboundHandler.close(ChannelHandlerContext, ChannelPromise)
method called of the next ChannelOutboundHandler contained in the ChannelPipeline of the
Channel.
ChannelFuture deregister()
EventExecutor and notify the
ChannelFuture once the operation completes, either because the operation was successful or because of
an error.
This will result in having the
ChannelOutboundHandler.deregister(ChannelHandlerContext, ChannelPromise)
method called of the next ChannelOutboundHandler contained in the ChannelPipeline of the
Channel.
ChannelFuture write(Object msg)
ChannelFuture
once the operation completes, either because the operation was successful or because of an error.ChannelFuture write(MessageList<?> msgs)
ChannelFuture bind(SocketAddress localAddress, ChannelPromise promise)
SocketAddress and notify the ChannelFuture once the operation
completes, either because the operation was successful or because of an error.
The given ChannelPromise will be notified.
This will result in having the
ChannelOutboundHandler.bind(ChannelHandlerContext, SocketAddress, ChannelPromise) method
called of the next ChannelOutboundHandler contained in the ChannelPipeline of the
Channel.
ChannelFuture connect(SocketAddress remoteAddress, ChannelPromise promise)
SocketAddress and notify the ChannelFuture once the operation
completes, either because the operation was successful or because of an error.
The given ChannelFuture will be notified.
If the connection fails because of a connection timeout, the ChannelFuture will get failed with
a ConnectTimeoutException. If it fails because of connection refused a ConnectException
will be used.
This will result in having the
ChannelOutboundHandler.connect(ChannelHandlerContext, SocketAddress, SocketAddress, ChannelPromise)
method called of the next ChannelOutboundHandler contained in the ChannelPipeline of the
Channel.
ChannelFuture connect(SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise promise)
SocketAddress while bind to the localAddress and notify the
ChannelFuture once the operation completes, either because the operation was successful or because of
an error.
The given ChannelPromise will be notified and also returned.
This will result in having the
ChannelOutboundHandler.connect(ChannelHandlerContext, SocketAddress, SocketAddress, ChannelPromise)
method called of the next ChannelOutboundHandler contained in the ChannelPipeline of the
Channel.
ChannelFuture disconnect(ChannelPromise promise)
ChannelFuture once the operation completes,
either because the operation was successful or because of an error.
The given ChannelPromise will be notified.
This will result in having the
ChannelOutboundHandler.disconnect(ChannelHandlerContext, ChannelPromise)
method called of the next ChannelOutboundHandler contained in the ChannelPipeline of the
Channel.
ChannelFuture close(ChannelPromise promise)
ChannelFuture once the operation completes,
either because the operation was successful or because of
an error.
After it is closed it is not possible to reuse it again.
The given ChannelPromise will be notified.
This will result in having the
ChannelOutboundHandler.close(ChannelHandlerContext, ChannelPromise)
method called of the next ChannelOutboundHandler contained in the ChannelPipeline of the
Channel.
ChannelFuture deregister(ChannelPromise promise)
EventExecutor and notify the
ChannelFuture once the operation completes, either because the operation was successful or because of
an error.
The given ChannelPromise will be notified.
This will result in having the
ChannelOutboundHandler.deregister(ChannelHandlerContext, ChannelPromise)
method called of the next ChannelOutboundHandler contained in the ChannelPipeline of the
Channel.
void read()
Channel into the first inbound buffer, triggers an
ChannelInboundHandler.messageReceived(ChannelHandlerContext, MessageList) event if data was
read, and triggers an
channelReadSuspended event so the
handler can decide to continue reading. If there's a pending read operation already, this method does nothing.
This will result in having the
ChannelOutboundHandler.read(ChannelHandlerContext)
method called of the next ChannelOutboundHandler contained in the ChannelPipeline of the
Channel.
ChannelFuture write(Object msg, ChannelPromise promise)
ChannelFuture
once the operation completes, either because the operation was successful or because of an error.ChannelFuture write(MessageList<?> msgs, ChannelPromise promise)
ChannelPipeline pipeline()
ChannelPipelineio.netty.buffer.ByteBufAllocator alloc()
ByteBufAllocator which will be used for allocate ByteBufs.ChannelPromise newPromise()
ChannelPromise.ChannelProgressivePromise newProgressivePromise()
ChannelProgressivePromiseChannelFuture newSucceededFuture()
ChannelFuture which is marked as successes already. So Future.isSuccess()
will return true. All FutureListener added to it will be notified directly. Also
every call of blocking methods will just return without blocking.ChannelFuture newFailedFuture(Throwable cause)
ChannelFuture which is marked as fakued already. So Future.isSuccess()
will return false. All FutureListener added to it will be notified directly. Also
every call of blocking methods will just return without blocking.ChannelPromise voidPromise()
It's only supported to use
it for ChannelOutboundInvoker.write(Object, ChannelPromise) and,
ChannelOutboundInvoker.write(MessageList, ChannelPromise).
Be aware that the returned ChannelPromise will not support most operations and should only be used
if you want to safe object allocation for every operation. You will not be able to detect if the operation
was complete, only if it failed as the implementation will call
ChannelPipeline.fireExceptionCaught(Throwable) in this case.
Copyright © 2008-2013 The Netty Project. All Rights Reserved.