public class OioServerSocketChannel extends AbstractOioMessageChannel implements ServerSocketChannel
ServerSocketChannel
接受新的连接并为他们创建OioSocketChannel
。
这个实现使用了Old-Blocking-IO。
AbstractChannel.AbstractUnsafe
Channel.Unsafe
SO_TIMEOUT
Constructor and Description |
---|
OioServerSocketChannel()
用新的
Socket 创建一个新实例
|
OioServerSocketChannel(java.net.ServerSocket socket)
从给定的
ServerSocket 创建一个新的实例
|
Modifier and Type | Method and Description |
---|---|
OioServerSocketChannelConfig |
config()
返回此频道的配置。
|
protected void |
doBind(java.net.SocketAddress localAddress)
将 Channel 绑定到SocketAddress
|
protected void |
doClose()
关闭 Channel
|
protected void |
doConnect(java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress)
如果指定了localAddress,则使用给定的localAddress连接到远程对等,否则连接到
null 。
|
protected void |
doDisconnect()
将此 Channel 从其远程对等端断开
|
protected int |
doReadMessages(java.util.List<java.lang.Object> buf)
将消息读入给定数组并返回读取的数量。
|
protected void |
doWrite(ChannelOutboundBuffer in)
将给定缓冲区的内容刷新到远程对等体。
|
protected java.lang.Object |
filterOutboundMessage(java.lang.Object msg)
在将新消息添加到此 AbstractChannel 的ChannelOutboundBuffer 时调用 ,以便Channel 实现将消息转换为另一个消息。
|
boolean |
isActive()
如果 Channel 处于活动状态且已连接,则返回true 。
|
boolean |
isOpen()
如果 Channel 已打开并且稍后可能会激活,则返回true
|
java.net.InetSocketAddress |
localAddress()
返回此通道绑定的本地地址。
|
protected java.net.SocketAddress |
localAddress0()
返回本地绑定的
SocketAddress 。
|
ChannelMetadata |
metadata()
返回 ChannelMetadata 的的Channel 其描述的性质Channel 。
|
java.net.InetSocketAddress |
remoteAddress()
返回此通道连接到的远程地址。
|
protected java.net.SocketAddress |
remoteAddress0()
返回 SocketAddress 其中Channel 被连接到。
|
protected void |
setReadPending(boolean readPending)
已过时。
|
doRead
clearReadPending, doBeginRead, isCompatible, isReadPending, newUnsafe
alloc, bind, bind, bytesBeforeUnwritable, bytesBeforeWritable, close, close, closeFuture, compareTo, connect, connect, connect, connect, deregister, deregister, disconnect, disconnect, doDeregister, doRegister, doShutdownOutput, equals, eventLoop, flush, hashCode, id, invalidateLocalAddress, invalidateRemoteAddress, isRegistered, isWritable, newChannelPipeline, newFailedFuture, newId, newProgressivePromise, newPromise, newSucceededFuture, parent, 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, parent, 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
public OioServerSocketChannel()
Socket
创建一个新实例
public OioServerSocketChannel(java.net.ServerSocket socket)
ServerSocket
创建一个新的实例
socket
- 此实例使用的
ServerSocket
public java.net.InetSocketAddress localAddress()
Channel
SocketAddress
应该被放入更具体的类型,例如InetSocketAddress
以检索详细信息。
localAddress
在界面
Channel
localAddress
在界面
ServerSocketChannel
localAddress
在课堂上
AbstractChannel
null
如果此通道未绑定。
public ChannelMetadata metadata()
Channel
复制的描述
ChannelMetadata
的的Channel
其描述的性质Channel
。
public OioServerSocketChannelConfig config()
Channel
复制的描述
config
在界面
Channel
config
在界面
ServerSocketChannel
public java.net.InetSocketAddress remoteAddress()
Channel
SocketAddress
应该被下推到更具体的类型,例如InetSocketAddress
以检索详细信息。
remoteAddress
在界面
Channel
remoteAddress
在界面
ServerSocketChannel
remoteAddress
在课堂上
AbstractChannel
null
如果此通道未连接。
如果此通道未连接,但它可以接收来自任意远程地址的消息(例如DatagramChannel
,请使用DefaultAddressedEnvelope.recipient()
来确定接收消息的来源,因为此方法将返回null
。
protected java.net.SocketAddress localAddress0()
AbstractChannel
SocketAddress
。
localAddress0
在课堂上
AbstractChannel
protected void doBind(java.net.SocketAddress localAddress) throws java.lang.Exception
AbstractChannel
Channel
绑定到SocketAddress
doBind
在课堂上
AbstractChannel
java.lang.Exception
protected void doClose() throws java.lang.Exception
AbstractChannel
Channel
doClose
在课堂上
AbstractChannel
java.lang.Exception
protected int doReadMessages(java.util.List<java.lang.Object> buf) throws java.lang.Exception
AbstractOioMessageChannel
doReadMessages
在课堂上
AbstractOioMessageChannel
java.lang.Exception
protected void doWrite(ChannelOutboundBuffer in) throws java.lang.Exception
AbstractChannel
doWrite
在课堂上
AbstractChannel
java.lang.Exception
protected java.lang.Object filterOutboundMessage(java.lang.Object msg) throws java.lang.Exception
AbstractChannel
AbstractChannel
的ChannelOutboundBuffer
中时调用 ,以便Channel
实现将消息转换为另一个消息。
(例如堆缓冲区 - >直接缓冲区)
filterOutboundMessage
在课堂上
AbstractChannel
java.lang.Exception
protected void doConnect(java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress) throws java.lang.Exception
AbstractOioChannel
null
否则连接到
null
。
doConnect
在课堂上
AbstractOioChannel
java.lang.Exception
protected java.net.SocketAddress remoteAddress0()
AbstractChannel
SocketAddress
其中Channel
被连接到。
remoteAddress0
在课堂上
AbstractChannel
protected void doDisconnect() throws java.lang.Exception
AbstractChannel
Channel
从其远程对等方断开
doDisconnect
在课堂上
AbstractChannel
java.lang.Exception
@Deprecated protected void setReadPending(boolean readPending)
setReadPending
在课堂上
AbstractOioChannel
Copyright © 2008–2018 The Netty Project. All rights reserved.