public class OioSocketChannel extends OioByteStreamChannel implements SocketChannel
SocketChannel
which is using Old-Blocking-IOAbstractChannel.AbstractUnsafe
Channel.Unsafe
SO_TIMEOUT
Constructor and Description |
---|
OioSocketChannel()
Create a new instance with an new
Socket |
OioSocketChannel(Channel parent,
Socket socket)
Create a new instance from the given
Socket |
OioSocketChannel(Socket socket)
Create a new instance from the given
Socket |
Modifier and Type | Method and Description |
---|---|
protected boolean |
checkInputShutdown() |
OioSocketChannelConfig |
config()
Returns the configuration of this channel.
|
protected void |
doBind(SocketAddress localAddress)
Bind the
Channel to the SocketAddress |
protected void |
doClose()
Close the
Channel |
protected void |
doConnect(SocketAddress remoteAddress,
SocketAddress localAddress)
Connect to the remote peer using the given localAddress if one is specified or
null otherwise. |
protected void |
doDisconnect()
Disconnect this
Channel from its remote peer |
protected int |
doReadBytes(ByteBuf buf)
Read bytes from the underlying Socket.
|
boolean |
isActive()
Return
true if the Channel is active and so connected. |
boolean |
isInputShutdown()
Determine if the input side of this channel is shutdown.
|
boolean |
isOpen()
Returns
true if the Channel is open and may get active later |
boolean |
isOutputShutdown() |
boolean |
isShutdown()
Determine if both the input and output of this channel have been shutdown.
|
InetSocketAddress |
localAddress()
Returns the local address where this channel is bound to.
|
protected SocketAddress |
localAddress0()
Returns the
SocketAddress which is bound locally. |
ServerSocketChannel |
parent()
Returns the parent of this channel.
|
InetSocketAddress |
remoteAddress()
Returns the remote address where this channel is connected to.
|
protected SocketAddress |
remoteAddress0()
Return the
SocketAddress which the Channel is connected to. |
protected void |
setReadPending(boolean readPending)
Deprecated.
|
ChannelFuture |
shutdown()
Will shutdown the input and output sides of this channel.
|
ChannelFuture |
shutdown(ChannelPromise promise)
Will shutdown the input and output sides of this channel.
|
ChannelFuture |
shutdownInput()
Shutdown the input side of this channel.
|
ChannelFuture |
shutdownInput(ChannelPromise promise)
Will shutdown the input and notify
ChannelPromise . |
ChannelFuture |
shutdownOutput() |
ChannelFuture |
shutdownOutput(ChannelPromise promise)
Will shutdown the output and notify
ChannelPromise . |
activate, available, doWriteBytes, doWriteFileRegion
doRead, doWrite, filterOutboundMessage, metadata
clearReadPending, doBeginRead, isCompatible, isReadPending, newUnsafe
alloc, bind, bind, bytesBeforeUnwritable, bytesBeforeWritable, close, close, closeFuture, compareTo, connect, connect, connect, connect, deregister, deregister, disconnect, disconnect, doDeregister, doRegister, equals, eventLoop, flush, hashCode, id, invalidateLocalAddress, invalidateRemoteAddress, isRegistered, isWritable, newChannelPipeline, newFailedFuture, newId, newProgressivePromise, newPromise, newSucceededFuture, pipeline, read, toString, unsafe, voidPromise, write, write, writeAndFlush, writeAndFlush
attr, hasAttr
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
alloc, bytesBeforeUnwritable, bytesBeforeWritable, closeFuture, eventLoop, flush, id, isRegistered, isWritable, metadata, pipeline, read, unsafe
attr, hasAttr
bind, bind, close, close, connect, connect, connect, connect, deregister, deregister, disconnect, disconnect, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, voidPromise, write, write, writeAndFlush, writeAndFlush
compareTo
public OioSocketChannel()
Socket
public OioSocketChannel(Socket socket)
Socket
socket
- the Socket
which is used by this instancepublic ServerSocketChannel parent()
Channel
parent
in interface Channel
parent
in interface SocketChannel
parent
in class AbstractChannel
null
if this channel does not have a parent channel.public OioSocketChannelConfig config()
Channel
config
in interface Channel
config
in interface SocketChannel
public boolean isOpen()
Channel
true
if the Channel
is open and may get active laterpublic boolean isActive()
Channel
true
if the Channel
is active and so connected.isActive
in interface Channel
isActive
in class OioByteStreamChannel
public boolean isOutputShutdown()
isOutputShutdown
in interface DuplexChannel
Socket.isOutputShutdown()
public boolean isInputShutdown()
AbstractOioByteChannel
isInputShutdown
in interface DuplexChannel
isInputShutdown
in class AbstractOioByteChannel
true
if the input side of this channel is shutdown.public boolean isShutdown()
DuplexChannel
isShutdown
in interface DuplexChannel
public ChannelFuture shutdownOutput()
shutdownOutput
in interface DuplexChannel
Socket.shutdownOutput()
public ChannelFuture shutdownInput()
AbstractOioByteChannel
shutdownInput
in interface DuplexChannel
shutdownInput
in class AbstractOioByteChannel
Socket.shutdownInput()
public ChannelFuture shutdown()
DuplexChannel
shutdown
in interface DuplexChannel
protected int doReadBytes(ByteBuf buf) throws Exception
AbstractOioByteChannel
doReadBytes
in class OioByteStreamChannel
buf
- the ByteBuf
into which the read bytes will be writtenException
- is thrown if an error occurredpublic ChannelFuture shutdownOutput(ChannelPromise promise)
DuplexChannel
ChannelPromise
.shutdownOutput
in interface DuplexChannel
Socket.shutdownOutput()
public ChannelFuture shutdownInput(ChannelPromise promise)
DuplexChannel
ChannelPromise
.shutdownInput
in interface DuplexChannel
Socket.shutdownInput()
public ChannelFuture shutdown(ChannelPromise promise)
DuplexChannel
shutdown
in interface DuplexChannel
promise
- will be completed when both shutdown operations complete.public InetSocketAddress localAddress()
Channel
SocketAddress
is supposed to be down-cast into more concrete
type such as InetSocketAddress
to retrieve the detailed
information.localAddress
in interface Channel
localAddress
in interface SocketChannel
localAddress
in class AbstractChannel
null
if this channel is not bound.public InetSocketAddress remoteAddress()
Channel
SocketAddress
is supposed to be down-cast into more
concrete type such as InetSocketAddress
to retrieve the detailed
information.remoteAddress
in interface Channel
remoteAddress
in interface SocketChannel
remoteAddress
in class AbstractChannel
null
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
.protected SocketAddress localAddress0()
AbstractChannel
SocketAddress
which is bound locally.localAddress0
in class AbstractChannel
protected SocketAddress remoteAddress0()
AbstractChannel
SocketAddress
which the Channel
is connected to.remoteAddress0
in class AbstractChannel
protected void doBind(SocketAddress localAddress) throws Exception
AbstractChannel
Channel
to the SocketAddress
doBind
in class AbstractChannel
Exception
protected void doConnect(SocketAddress remoteAddress, SocketAddress localAddress) throws Exception
AbstractOioChannel
null
otherwise.doConnect
in class AbstractOioChannel
Exception
protected void doDisconnect() throws Exception
AbstractChannel
Channel
from its remote peerdoDisconnect
in class AbstractChannel
Exception
protected void doClose() throws Exception
AbstractChannel
Channel
doClose
in class OioByteStreamChannel
Exception
protected boolean checkInputShutdown()
@Deprecated protected void setReadPending(boolean readPending)
setReadPending
in class AbstractOioChannel
Copyright © 2008–2017 The Netty Project. All rights reserved.