public class NioUdpServer extends AbstractUdpServer implements SelectorListener
AbstractIoService.ServiceState
config, ioHandlerExecutor
Constructor and Description |
---|
NioUdpServer()
Create an UDP server with a new selector pool of default size and a
IoHandlerExecutor of default type (
OrderedHandlerExecutor ) |
NioUdpServer(SelectorLoop readSelectorLoop,
IoHandlerExecutor handlerExecutor)
Create an UDP server with provided selector loops pool
|
NioUdpServer(UdpSessionConfig config)
Create an UDP server with a new selector pool of default size and a
IoHandlerExecutor of default type (
OrderedHandlerExecutor ) |
NioUdpServer(UdpSessionConfig config,
SelectorLoop readSelectorLoop,
IoHandlerExecutor handlerExecutor)
Create an UDP server with provided selector loops pool
|
Modifier and Type | Method and Description |
---|---|
void |
bind(int port)
Binds the server to the specified port.
|
void |
bind(SocketAddress localAddress)
Binds to the specified local addresses and start to accept incoming connections.
|
IoFuture<IoSession> |
connect(SocketAddress remoteAddress)
Connects to the specified remote address.
|
SocketAddress |
getBoundAddress()
Returns the local addresses which are bound currently.
|
DatagramChannel |
getDatagramChannel()
Get the inner datagram channel for read and write operations.
|
SelectionKey |
getReadKey() |
void |
ready(boolean accept,
boolean connect,
boolean read,
ByteBuffer readBuffer,
boolean write) |
void |
setReadKey(SelectionKey readKey) |
void |
unbind()
Unbinds from the local addresses that this service is bound to and stops to accept incoming connections.
|
getSessionConfig, initSecured, setSessionConfig
isReuseAddress, setReuseAddress, setSessionConfig
fireServiceActivated, fireServiceInactivated, getFilters, getIoHandler, getIoHandlerExecutor, getManagedSessions, initState, isActive, isCreated, isDisposed, isDisposing, isSuspended, setActive, setCreated, setDisposed, setDisposing, setFilters, setIoHandler, setSuspended
public NioUdpServer()
IoHandlerExecutor
of default type (
OrderedHandlerExecutor
)public NioUdpServer(UdpSessionConfig config)
IoHandlerExecutor
of default type (
OrderedHandlerExecutor
)sessionConfig
- The configuration to use for this serverpublic NioUdpServer(SelectorLoop readSelectorLoop, IoHandlerExecutor handlerExecutor)
acceptSelectorLoop
- the selector loop for handling accept events (connection of new session)readWriteSelectorLoop
- the pool of selector loop for handling read/write events of connected sessionsioHandlerExecutor
- used for executing IoHandler event in another pool of thread (not in the low level I/O
one). Use null
if you don't want one. Be careful, the IoHandler processing will block the I/O
operations.public NioUdpServer(UdpSessionConfig config, SelectorLoop readSelectorLoop, IoHandlerExecutor handlerExecutor)
sessionConfig
- The configuration to use for this serveracceptSelectorLoop
- the selector loop for handling accept events (connection of new session)ioHandlerExecutor
- used for executing IoHandler event in another pool of thread (not in the low level I/O
one). Use null
if you don't want one. Be careful, the IoHandler processing will block the I/O
operations.public DatagramChannel getDatagramChannel()
NioSelectorProcessor
NioUdpServer
.public SocketAddress getBoundAddress()
getBoundAddress
in interface IoServer
public void bind(int port)
public void bind(SocketAddress localAddress)
public IoFuture<IoSession> connect(SocketAddress remoteAddress)
IoClient
connect
in interface IoClient
remoteAddress
- Remote SocketAddress
to connectIoFuture
instance which is completed when the connection attempt initiated by this call
succeeds or fails.public void unbind()
public SelectionKey getReadKey()
public void setReadKey(SelectionKey readKey)
readKey
- the readKey to setpublic void ready(boolean accept, boolean connect, boolean read, ByteBuffer readBuffer, boolean write)
ready
in interface SelectorListener
Copyright © 2009–2013 Apache MINA Project. All rights reserved.