public class UDPClientServer
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static io.netty.util.AttributeKey<UDPClientServer> |
ATTRIBUTE_CLIENT_SERVER |
protected io.netty.bootstrap.Bootstrap |
bootstrap |
protected io.netty.channel.ChannelFuture |
channelFuture |
protected io.netty.channel.ChannelInitializer<io.netty.channel.socket.DatagramChannel> |
channelInitializer |
protected UDPChannelType |
channelType |
| Constructor and Description |
|---|
UDPClientServer(io.netty.channel.ChannelInitializer<io.netty.channel.socket.DatagramChannel> channelInitializer)
Create a new UDP client/server.
|
UDPClientServer(io.netty.channel.ChannelInitializer<io.netty.channel.socket.DatagramChannel> channelInitializer,
UDPChannelType channelType)
Create a new UDP client/server.
|
| Modifier and Type | Method and Description |
|---|---|
void |
bind(java.lang.String host,
int port,
boolean sync)
Bind the server to the given host and port.
|
void |
close()
Close the connected channel future.
|
protected void |
configureBootstrap()
Configure the bootstrap channel, event group and options.
|
void |
connect(java.net.SocketAddress address,
boolean sync)
Connect the client to the given address.
|
void |
connect(java.lang.String host,
int port,
boolean sync)
Connect the client to the given host and port.
|
io.netty.bootstrap.Bootstrap |
getBootstrap() |
io.netty.channel.ChannelFuture |
getChannelFuture() |
UDPChannelType |
getChannelType() |
public static final io.netty.util.AttributeKey<UDPClientServer> ATTRIBUTE_CLIENT_SERVER
protected final io.netty.channel.ChannelInitializer<io.netty.channel.socket.DatagramChannel> channelInitializer
protected final UDPChannelType channelType
protected final io.netty.bootstrap.Bootstrap bootstrap
protected io.netty.channel.ChannelFuture channelFuture
public UDPClientServer(io.netty.channel.ChannelInitializer<io.netty.channel.socket.DatagramChannel> channelInitializer)
channelInitializer - The channel initializer to usepublic UDPClientServer(io.netty.channel.ChannelInitializer<io.netty.channel.socket.DatagramChannel> channelInitializer,
UDPChannelType channelType)
channelInitializer - The channel initializer to usechannelType - The channel type to usepublic UDPChannelType getChannelType()
protected void configureBootstrap()
public void bind(java.lang.String host,
int port,
boolean sync)
host - The host to bind toport - The port to bind tosync - If the method should wait for the bind to completepublic void connect(java.lang.String host,
int port,
boolean sync)
host - The host to connect toport - The port to connect tosync - If the method should wait for the connect to completepublic void connect(java.net.SocketAddress address,
boolean sync)
address - The address to connect tosync - If the method should wait for the connect to completepublic io.netty.bootstrap.Bootstrap getBootstrap()
public io.netty.channel.ChannelFuture getChannelFuture()
public void close()