public interface IoAcceptor extends IoSessionManager
IoHandler
s.
Please refer to EchoServer example.
You should bind to the desired socket address to accept incoming
connections, and then events for incoming connections will be sent to
the specified default IoHandler
.
Threads accept incoming connections start automatically when
bind(SocketAddress, IoHandler)
is invoked, and stop when all
addresses are unbound.
Modifier and Type | Method and Description |
---|---|
void |
bind(java.net.SocketAddress address,
IoHandler handler)
Binds to the specified
address and handles incoming
connections with the specified handler . |
IoSession |
newSession(java.net.SocketAddress remoteAddress,
java.net.SocketAddress localAddress)
(Optional) Returns an
IoSession that is bound to the specified
localAddress and remoteAddress which reuses
the localAddress that is already bound by IoAcceptor
via bind(SocketAddress, IoHandler) . |
void |
unbind(java.net.SocketAddress address)
Unbinds from the specified
address . |
getFilterChain
getExceptionMonitor, setExceptionMonitor
void bind(java.net.SocketAddress address, IoHandler handler) throws java.io.IOException
address
and handles incoming
connections with the specified handler
.java.io.IOException
- if failed to bindvoid unbind(java.net.SocketAddress address)
address
.IoSession newSession(java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress)
IoSession
that is bound to the specified
localAddress and remoteAddress which reuses
the localAddress that is already bound by IoAcceptor
via bind(SocketAddress, IoHandler)
.
This operation is optional. Please throw UnsupportedOperationException
if the transport type doesn't support this operation. This operation is
usually implemented for connectionless transport types.
java.lang.UnsupportedOperationException
- if this operation is not supportedjava.lang.IllegalArgumentException
- if the specified localAddress is
not bound yet. (see bind(SocketAddress, IoHandler)
)