Package io.netty.channel.socket.nio
Class NioDatagramChannelConfig
- java.lang.Object
-
- io.netty.channel.DefaultChannelConfig
-
- io.netty.channel.socket.DefaultDatagramChannelConfig
-
- io.netty.channel.socket.nio.NioDatagramChannelConfig
-
- All Implemented Interfaces:
ChannelConfig
,DatagramChannelConfig
class NioDatagramChannelConfig extends DefaultDatagramChannelConfig
The defaultNioDatagramChannelConfig
implementation.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.reflect.Method
GET_OPTION
private static java.lang.Object
IP_MULTICAST_IF
private static java.lang.Object
IP_MULTICAST_LOOP
private static java.lang.Object
IP_MULTICAST_TTL
private java.nio.channels.DatagramChannel
javaChannel
private static java.lang.reflect.Method
SET_OPTION
-
Fields inherited from class io.netty.channel.DefaultChannelConfig
channel
-
-
Constructor Summary
Constructors Constructor Description NioDatagramChannelConfig(NioDatagramChannel channel, java.nio.channels.DatagramChannel javaChannel)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
autoReadCleared()
Is called onceDefaultChannelConfig.setAutoRead(boolean)
is called withfalse
andDefaultChannelConfig.isAutoRead()
wastrue
before.java.net.InetAddress
getInterface()
Gets the address of the network interface used for multicast packets.java.net.NetworkInterface
getNetworkInterface()
Gets theStandardSocketOptions.IP_MULTICAST_IF
option.<T> T
getOption(ChannelOption<T> option)
Return the value of the givenChannelOption
private java.lang.Object
getOption0(java.lang.Object option)
java.util.Map<ChannelOption<?>,java.lang.Object>
getOptions()
Return all setChannelOption
's.int
getTimeToLive()
Gets theStandardSocketOptions.IP_MULTICAST_TTL
option.boolean
isLoopbackModeDisabled()
Gets theStandardSocketOptions.IP_MULTICAST_LOOP
option.DatagramChannelConfig
setAutoRead(boolean autoRead)
Sets ifChannelHandlerContext.read()
will be invoked automatically so that a user application doesn't need to call it at all.DatagramChannelConfig
setInterface(java.net.InetAddress interfaceAddress)
Sets the address of the network interface used for multicast packets.DatagramChannelConfig
setLoopbackModeDisabled(boolean loopbackModeDisabled)
Sets theStandardSocketOptions.IP_MULTICAST_LOOP
option.DatagramChannelConfig
setNetworkInterface(java.net.NetworkInterface networkInterface)
Sets theStandardSocketOptions.IP_MULTICAST_IF
option.<T> boolean
setOption(ChannelOption<T> option, T value)
Sets a configuration property with the specified name and value.private void
setOption0(java.lang.Object option, java.lang.Object value)
DatagramChannelConfig
setTimeToLive(int ttl)
Sets theStandardSocketOptions.IP_MULTICAST_TTL
option.-
Methods inherited from class io.netty.channel.socket.DefaultDatagramChannelConfig
getReceiveBufferSize, getSendBufferSize, getTrafficClass, isBroadcast, isReuseAddress, javaSocket, setAllocator, setAutoClose, setBroadcast, setConnectTimeoutMillis, setMaxMessagesPerRead, setMaxMessagesPerWrite, setMessageSizeEstimator, setReceiveBufferSize, setRecvByteBufAllocator, setReuseAddress, setSendBufferSize, setTrafficClass, setWriteBufferHighWaterMark, setWriteBufferLowWaterMark, setWriteBufferWaterMark, setWriteSpinCount
-
Methods inherited from class io.netty.channel.DefaultChannelConfig
getAllocator, getConnectTimeoutMillis, getMaxMessagesPerRead, getMaxMessagesPerWrite, getMessageSizeEstimator, getOptions, getRecvByteBufAllocator, getWriteBufferHighWaterMark, getWriteBufferLowWaterMark, getWriteBufferWaterMark, getWriteSpinCount, isAutoClose, isAutoRead, setOptions, validate
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.netty.channel.ChannelConfig
getAllocator, getConnectTimeoutMillis, getMaxMessagesPerRead, getMessageSizeEstimator, getRecvByteBufAllocator, getWriteBufferHighWaterMark, getWriteBufferLowWaterMark, getWriteBufferWaterMark, getWriteSpinCount, isAutoClose, isAutoRead, setOptions
-
-
-
-
Field Detail
-
IP_MULTICAST_TTL
private static final java.lang.Object IP_MULTICAST_TTL
-
IP_MULTICAST_IF
private static final java.lang.Object IP_MULTICAST_IF
-
IP_MULTICAST_LOOP
private static final java.lang.Object IP_MULTICAST_LOOP
-
GET_OPTION
private static final java.lang.reflect.Method GET_OPTION
-
SET_OPTION
private static final java.lang.reflect.Method SET_OPTION
-
javaChannel
private final java.nio.channels.DatagramChannel javaChannel
-
-
Constructor Detail
-
NioDatagramChannelConfig
NioDatagramChannelConfig(NioDatagramChannel channel, java.nio.channels.DatagramChannel javaChannel)
-
-
Method Detail
-
getTimeToLive
public int getTimeToLive()
Description copied from interface:DatagramChannelConfig
Gets theStandardSocketOptions.IP_MULTICAST_TTL
option.- Specified by:
getTimeToLive
in interfaceDatagramChannelConfig
- Overrides:
getTimeToLive
in classDefaultDatagramChannelConfig
-
setTimeToLive
public DatagramChannelConfig setTimeToLive(int ttl)
Description copied from interface:DatagramChannelConfig
Sets theStandardSocketOptions.IP_MULTICAST_TTL
option.- Specified by:
setTimeToLive
in interfaceDatagramChannelConfig
- Overrides:
setTimeToLive
in classDefaultDatagramChannelConfig
-
getInterface
public java.net.InetAddress getInterface()
Description copied from interface:DatagramChannelConfig
Gets the address of the network interface used for multicast packets.- Specified by:
getInterface
in interfaceDatagramChannelConfig
- Overrides:
getInterface
in classDefaultDatagramChannelConfig
-
setInterface
public DatagramChannelConfig setInterface(java.net.InetAddress interfaceAddress)
Description copied from interface:DatagramChannelConfig
Sets the address of the network interface used for multicast packets.- Specified by:
setInterface
in interfaceDatagramChannelConfig
- Overrides:
setInterface
in classDefaultDatagramChannelConfig
-
getNetworkInterface
public java.net.NetworkInterface getNetworkInterface()
Description copied from interface:DatagramChannelConfig
Gets theStandardSocketOptions.IP_MULTICAST_IF
option.- Specified by:
getNetworkInterface
in interfaceDatagramChannelConfig
- Overrides:
getNetworkInterface
in classDefaultDatagramChannelConfig
-
setNetworkInterface
public DatagramChannelConfig setNetworkInterface(java.net.NetworkInterface networkInterface)
Description copied from interface:DatagramChannelConfig
Sets theStandardSocketOptions.IP_MULTICAST_IF
option.- Specified by:
setNetworkInterface
in interfaceDatagramChannelConfig
- Overrides:
setNetworkInterface
in classDefaultDatagramChannelConfig
-
isLoopbackModeDisabled
public boolean isLoopbackModeDisabled()
Description copied from interface:DatagramChannelConfig
Gets theStandardSocketOptions.IP_MULTICAST_LOOP
option.- Specified by:
isLoopbackModeDisabled
in interfaceDatagramChannelConfig
- Overrides:
isLoopbackModeDisabled
in classDefaultDatagramChannelConfig
- Returns:
true
if and only if the loopback mode has been disabled
-
setLoopbackModeDisabled
public DatagramChannelConfig setLoopbackModeDisabled(boolean loopbackModeDisabled)
Description copied from interface:DatagramChannelConfig
Sets theStandardSocketOptions.IP_MULTICAST_LOOP
option.- Specified by:
setLoopbackModeDisabled
in interfaceDatagramChannelConfig
- Overrides:
setLoopbackModeDisabled
in classDefaultDatagramChannelConfig
- Parameters:
loopbackModeDisabled
-true
if and only if the loopback mode has been disabled
-
setAutoRead
public DatagramChannelConfig setAutoRead(boolean autoRead)
Description copied from interface:ChannelConfig
Sets ifChannelHandlerContext.read()
will be invoked automatically so that a user application doesn't need to call it at all. The default value istrue
.- Specified by:
setAutoRead
in interfaceChannelConfig
- Specified by:
setAutoRead
in interfaceDatagramChannelConfig
- Overrides:
setAutoRead
in classDefaultDatagramChannelConfig
-
autoReadCleared
protected void autoReadCleared()
Description copied from class:DefaultChannelConfig
Is called onceDefaultChannelConfig.setAutoRead(boolean)
is called withfalse
andDefaultChannelConfig.isAutoRead()
wastrue
before.- Overrides:
autoReadCleared
in classDefaultChannelConfig
-
getOption0
private java.lang.Object getOption0(java.lang.Object option)
-
setOption0
private void setOption0(java.lang.Object option, java.lang.Object value)
-
setOption
public <T> boolean setOption(ChannelOption<T> option, T value)
Description copied from interface:ChannelConfig
Sets a configuration property with the specified name and value. To override this method properly, you must call the super class:public boolean setOption(ChannelOption<T> option, T value) { if (super.setOption(option, value)) { return true; } if (option.equals(additionalOption)) { .... return true; } return false; }
- Specified by:
setOption
in interfaceChannelConfig
- Overrides:
setOption
in classDefaultDatagramChannelConfig
- Returns:
true
if and only if the property has been set
-
getOption
public <T> T getOption(ChannelOption<T> option)
Description copied from interface:ChannelConfig
Return the value of the givenChannelOption
- Specified by:
getOption
in interfaceChannelConfig
- Overrides:
getOption
in classDefaultDatagramChannelConfig
-
getOptions
public java.util.Map<ChannelOption<?>,java.lang.Object> getOptions()
Description copied from interface:ChannelConfig
Return all setChannelOption
's.- Specified by:
getOptions
in interfaceChannelConfig
- Overrides:
getOptions
in classDefaultDatagramChannelConfig
-
-