Top Description Methods
io.netty.channel.socket

public Interface DatagramChannelConfig

extends ChannelConfig
Known Direct Subinterfaces
io.netty.channel.socket.oio.OioDatagramChannelConfig
Known Direct Implementers
io.netty.channel.socket.DefaultDatagramChannelConfig
Imports
io.netty.buffer.ByteBufAllocator, io.netty.channel.ChannelConfig, .ChannelOption, .MessageSizeEstimator, .RecvByteBufAllocator, .WriteBufferWaterMark, java.net.InetAddress, .NetworkInterface, .StandardSocketOptions

A ChannelConfig for a DatagramChannel.

Available options

In addition to the options provided by ChannelConfig, DatagramChannelConfig allows the following options in the option map:
NameAssociated setter method
ChannelOption#SO_BROADCASTsetBroadcast(boolean)
ChannelOption#IP_MULTICAST_ADDRsetInterface(InetAddress)
ChannelOption#IP_MULTICAST_LOOP_DISABLED setLoopbackModeDisabled(boolean)
ChannelOption#IP_MULTICAST_IF setNetworkInterface(NetworkInterface)
ChannelOption#SO_REUSEADDRsetReuseAddress(boolean)
ChannelOption#SO_RCVBUFsetReceiveBufferSize(int)
ChannelOption#SO_SNDBUFsetSendBufferSize(int)
ChannelOption#IP_MULTICAST_TTLsetTimeToLive(int)
ChannelOption#IP_TOSsetTrafficClass(int)

Method Summary

Modifier and TypeMethod and Description
public InetAddress
getInterface()

Gets the address of the network interface used for multicast packets.

public NetworkInterface
public int
public int
public int
public int
public boolean
public boolean

Returns:

true if and only if the loopback mode has been disabled
isLoopbackModeDisabled
()

Gets the StandardSocketOptions#IP_MULTICAST_LOOP option.

public boolean
public DatagramChannelConfig
setAllocator(ByteBufAllocator allocator)

Redeclares io.netty.channel.ChannelConfig.setAllocator.

Set the ByteBufAllocator which is used for the channel to allocate buffers.
public DatagramChannelConfig
setAutoClose(boolean autoClose)

Redeclares io.netty.channel.ChannelConfig.setAutoClose.

Sets whether the Channel should be closed automatically and immediately on write failure.
public DatagramChannelConfig
setAutoRead(boolean autoRead)

Redeclares io.netty.channel.ChannelConfig.setAutoRead.

Sets if ChannelHandlerContext#read() will be invoked automatically so that a user application doesn't need to call it at all.
public DatagramChannelConfig
setBroadcast(boolean broadcast)

Sets the StandardSocketOptions#SO_BROADCAST option.

public DatagramChannelConfig
setConnectTimeoutMillis(int
the connect timeout in milliseconds. 0 to disable.
connectTimeoutMillis
)

Redeclares io.netty.channel.ChannelConfig.setConnectTimeoutMillis.

Sets the connect timeout of the channel in milliseconds.
public DatagramChannelConfig
setInterface(InetAddress interfaceAddress)

Sets the address of the network interface used for multicast packets.

public DatagramChannelConfig
setLoopbackModeDisabled(boolean
true if and only if the loopback mode has been disabled
loopbackModeDisabled
)

Sets the StandardSocketOptions#IP_MULTICAST_LOOP option.

public DatagramChannelConfig
public DatagramChannelConfig
setMessageSizeEstimator(MessageSizeEstimator estimator)

Redeclares io.netty.channel.ChannelConfig.setMessageSizeEstimator.

Set the MessageSizeEstimator which is used for the channel to detect the size of a message.
public DatagramChannelConfig
public DatagramChannelConfig
setReceiveBufferSize(int receiveBufferSize)

Sets the StandardSocketOptions#SO_RCVBUF option.

public DatagramChannelConfig
setRecvByteBufAllocator(RecvByteBufAllocator allocator)

Redeclares io.netty.channel.ChannelConfig.setRecvByteBufAllocator.

Set the RecvByteBufAllocator which is used for the channel to allocate receive buffers.
public DatagramChannelConfig
setReuseAddress(boolean reuseAddress)

Gets the StandardSocketOptions#SO_REUSEADDR option.

public DatagramChannelConfig
setSendBufferSize(int sendBufferSize)

Sets the StandardSocketOptions#SO_SNDBUF option.

public DatagramChannelConfig
public DatagramChannelConfig
setTrafficClass(int trafficClass)

Sets the StandardSocketOptions#IP_TOS option.

public DatagramChannelConfig
setWriteBufferWaterMark(WriteBufferWaterMark writeBufferWaterMark)

Redeclares io.netty.channel.ChannelConfig.setWriteBufferWaterMark.

Set the WriteBufferWaterMark which is used for setting the high and low water mark of the write buffer.
public DatagramChannelConfig
setWriteSpinCount(int writeSpinCount)

Redeclares io.netty.channel.ChannelConfig.setWriteSpinCount.

Sets the maximum loop count for a write operation until WritableByteChannel#write(ByteBuffer) returns a non-zero value.
Inherited from io.netty.channel.ChannelConfig:
getAllocatorgetConnectTimeoutMillisgetMaxMessagesPerReadgetMessageSizeEstimatorgetOptiongetOptionsgetRecvByteBufAllocatorgetWriteBufferHighWaterMarkgetWriteBufferLowWaterMarkgetWriteBufferWaterMarkgetWriteSpinCountisAutoCloseisAutoReadsetOptionsetOptionssetWriteBufferHighWaterMarksetWriteBufferLowWaterMark

Method Detail

getInterfaceback to summary
public InetAddress getInterface()

Gets the address of the network interface used for multicast packets.

getNetworkInterfaceback to summary
public NetworkInterface getNetworkInterface()

Gets the StandardSocketOptions#IP_MULTICAST_IF option.

getReceiveBufferSizeback to summary
public int getReceiveBufferSize()

Gets the StandardSocketOptions#SO_RCVBUF option.

getSendBufferSizeback to summary
public int getSendBufferSize()

Gets the StandardSocketOptions#SO_SNDBUF option.

getTimeToLiveback to summary
public int getTimeToLive()

Gets the StandardSocketOptions#IP_MULTICAST_TTL option.

getTrafficClassback to summary
public int getTrafficClass()

Gets the StandardSocketOptions#IP_TOS option.

isBroadcastback to summary
public boolean isBroadcast()

Gets the StandardSocketOptions#SO_BROADCAST option.

isLoopbackModeDisabledback to summary
public boolean isLoopbackModeDisabled()

Gets the StandardSocketOptions#IP_MULTICAST_LOOP option.

Returns:boolean

true if and only if the loopback mode has been disabled

isReuseAddressback to summary
public boolean isReuseAddress()

Gets the StandardSocketOptions#SO_REUSEADDR option.

setAllocatorback to summary
public DatagramChannelConfig setAllocator(ByteBufAllocator allocator)

Redeclares io.netty.channel.ChannelConfig.setAllocator.

Doc from io.netty.channel.ChannelConfig.setAllocator.

Set the ByteBufAllocator which is used for the channel to allocate buffers.

Annotations
@Override
setAutoCloseback to summary
public DatagramChannelConfig setAutoClose(boolean autoClose)

Redeclares io.netty.channel.ChannelConfig.setAutoClose.

Doc from io.netty.channel.ChannelConfig.setAutoClose.

Sets whether the Channel should be closed automatically and immediately on write failure. The default is true.

Annotations
@Override
setAutoReadback to summary
public DatagramChannelConfig setAutoRead(boolean autoRead)

Redeclares io.netty.channel.ChannelConfig.setAutoRead.

Doc from io.netty.channel.ChannelConfig.setAutoRead.

Sets if ChannelHandlerContext#read() will be invoked automatically so that a user application doesn't need to call it at all. The default value is true.

Annotations
@Override
setBroadcastback to summary
public DatagramChannelConfig setBroadcast(boolean broadcast)

Sets the StandardSocketOptions#SO_BROADCAST option.

setConnectTimeoutMillisback to summary
public DatagramChannelConfig setConnectTimeoutMillis(int connectTimeoutMillis)

Redeclares io.netty.channel.ChannelConfig.setConnectTimeoutMillis.

Doc from io.netty.channel.ChannelConfig.setConnectTimeoutMillis.

Sets the connect timeout of the channel in milliseconds. If the Channel does not support connect operation, this property is not used at all, and therefore will be ignored.

Parameters
connectTimeoutMillis:int

the connect timeout in milliseconds. 0 to disable.

Annotations
@Override
setInterfaceback to summary
public DatagramChannelConfig setInterface(InetAddress interfaceAddress)

Sets the address of the network interface used for multicast packets.

setLoopbackModeDisabledback to summary
public DatagramChannelConfig setLoopbackModeDisabled(boolean loopbackModeDisabled)

Sets the StandardSocketOptions#IP_MULTICAST_LOOP option.

Parameters
loopbackModeDisabled:boolean

true if and only if the loopback mode has been disabled

setMaxMessagesPerReadback to summary
public DatagramChannelConfig setMaxMessagesPerRead(int maxMessagesPerRead)

Redeclares io.netty.channel.ChannelConfig.setMaxMessagesPerRead.

Deprecated

Annotations
@Override
@Deprecated
setMessageSizeEstimatorback to summary
public DatagramChannelConfig setMessageSizeEstimator(MessageSizeEstimator estimator)

Redeclares io.netty.channel.ChannelConfig.setMessageSizeEstimator.

Doc from io.netty.channel.ChannelConfig.setMessageSizeEstimator.

Set the MessageSizeEstimator which is used for the channel to detect the size of a message.

Annotations
@Override
setNetworkInterfaceback to summary
public DatagramChannelConfig setNetworkInterface(NetworkInterface networkInterface)

Sets the StandardSocketOptions#IP_MULTICAST_IF option.

setReceiveBufferSizeback to summary
public DatagramChannelConfig setReceiveBufferSize(int receiveBufferSize)

Sets the StandardSocketOptions#SO_RCVBUF option.

setRecvByteBufAllocatorback to summary
public DatagramChannelConfig setRecvByteBufAllocator(RecvByteBufAllocator allocator)

Redeclares io.netty.channel.ChannelConfig.setRecvByteBufAllocator.

Doc from io.netty.channel.ChannelConfig.setRecvByteBufAllocator.

Set the RecvByteBufAllocator which is used for the channel to allocate receive buffers.

Annotations
@Override
setReuseAddressback to summary
public DatagramChannelConfig setReuseAddress(boolean reuseAddress)

Gets the StandardSocketOptions#SO_REUSEADDR option.

setSendBufferSizeback to summary
public DatagramChannelConfig setSendBufferSize(int sendBufferSize)

Sets the StandardSocketOptions#SO_SNDBUF option.

setTimeToLiveback to summary
public DatagramChannelConfig setTimeToLive(int ttl)

Sets the StandardSocketOptions#IP_MULTICAST_TTL option.

setTrafficClassback to summary
public DatagramChannelConfig setTrafficClass(int trafficClass)

Sets the StandardSocketOptions#IP_TOS option.

setWriteBufferWaterMarkback to summary
public DatagramChannelConfig setWriteBufferWaterMark(WriteBufferWaterMark writeBufferWaterMark)

Redeclares io.netty.channel.ChannelConfig.setWriteBufferWaterMark.

Doc from io.netty.channel.ChannelConfig.setWriteBufferWaterMark.

Set the WriteBufferWaterMark which is used for setting the high and low water mark of the write buffer.

Annotations
@Override
setWriteSpinCountback to summary
public DatagramChannelConfig setWriteSpinCount(int writeSpinCount)

Redeclares io.netty.channel.ChannelConfig.setWriteSpinCount.

Doc from io.netty.channel.ChannelConfig.setWriteSpinCount.

Sets the maximum loop count for a write operation until WritableByteChannel#write(ByteBuffer) returns a non-zero value. It is similar to what a spin lock is used for in concurrency programming. It improves memory utilization and write throughput depending on the platform that JVM runs on. The default value is 16.

Annotations
@Override