Class NioDatagramSessionConfig
- java.lang.Object
-
- org.apache.mina.core.session.AbstractIoSessionConfig
-
- org.apache.mina.transport.socket.AbstractDatagramSessionConfig
-
- org.apache.mina.transport.socket.nio.NioDatagramSessionConfig
-
- All Implemented Interfaces:
IoSessionConfig,DatagramSessionConfig
class NioDatagramSessionConfig extends AbstractDatagramSessionConfig
Define the configuration for a Datagram based session.- Author:
- Apache MINA Project
-
-
Constructor Summary
Constructors Constructor Description NioDatagramSessionConfig(DatagramChannel channel)Creates a new instance of NioDatagramSessionConfig, associated with the given DatagramChannel.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetReceiveBufferSize()Get the Socket receive buffer size for this DatagramChannel.intgetSendBufferSize()intgetTrafficClass()Get the current Traffic Class for this Socket, if any.booleanisBroadcast()Tells if SO_BROADCAST is enabled.booleanisReuseAddress()Tells if SO_REUSEADDR is enabled.voidsetBroadcast(boolean broadcast)voidsetReceiveBufferSize(int receiveBufferSize)Set the Socket receive buffer size for this DatagramChannel.voidsetReuseAddress(boolean reuseAddress)voidsetSendBufferSize(int sendBufferSize)voidsetTrafficClass(int trafficClass)-
Methods inherited from class org.apache.mina.transport.socket.AbstractDatagramSessionConfig
isBroadcastChanged, isCloseOnPortUnreachable, isReceiveBufferSizeChanged, isReuseAddressChanged, isSendBufferSizeChanged, isTrafficClassChanged, setAll, setCloseOnPortUnreachable
-
Methods inherited from class org.apache.mina.core.session.AbstractIoSessionConfig
getBothIdleTime, getBothIdleTimeInMillis, getIdleTime, getIdleTimeInMillis, getMaxReadBufferSize, getMinReadBufferSize, getReadBufferSize, getReaderIdleTime, getReaderIdleTimeInMillis, getThroughputCalculationInterval, getThroughputCalculationIntervalInMillis, getWriterIdleTime, getWriterIdleTimeInMillis, getWriteTimeout, getWriteTimeoutInMillis, isUseReadOperation, setBothIdleTime, setIdleTime, setMaxReadBufferSize, setMinReadBufferSize, setReadBufferSize, setReaderIdleTime, setThroughputCalculationInterval, setUseReadOperation, setWriterIdleTime, setWriteTimeout
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.mina.core.session.IoSessionConfig
getBothIdleTime, getBothIdleTimeInMillis, getIdleTime, getIdleTimeInMillis, getMaxReadBufferSize, getMinReadBufferSize, getReadBufferSize, getReaderIdleTime, getReaderIdleTimeInMillis, getThroughputCalculationInterval, getThroughputCalculationIntervalInMillis, getWriterIdleTime, getWriterIdleTimeInMillis, getWriteTimeout, getWriteTimeoutInMillis, isUseReadOperation, setBothIdleTime, setIdleTime, setMaxReadBufferSize, setMinReadBufferSize, setReadBufferSize, setReaderIdleTime, setThroughputCalculationInterval, setUseReadOperation, setWriterIdleTime, setWriteTimeout
-
-
-
-
Constructor Detail
-
NioDatagramSessionConfig
NioDatagramSessionConfig(DatagramChannel channel)
Creates a new instance of NioDatagramSessionConfig, associated with the given DatagramChannel.- Parameters:
channel- The associated DatagramChannel
-
-
Method Detail
-
getReceiveBufferSize
public int getReceiveBufferSize()
Get the Socket receive buffer size for this DatagramChannel.- Returns:
- the DatagramChannel receive buffer size.
- Throws:
RuntimeIoException- if the socket is closed or if we had a SocketException- See Also:
DatagramSocket.getReceiveBufferSize()
-
setReceiveBufferSize
public void setReceiveBufferSize(int receiveBufferSize)
Set the Socket receive buffer size for this DatagramChannel.
Note : The underlying Socket may not accept the new buffer's size. The user has to check that the new value has been set.- Parameters:
receiveBufferSize- the DatagramChannel receive buffer size.- Throws:
RuntimeIoException- if the socket is closed or if we had a SocketException- See Also:
DatagramSocket.setReceiveBufferSize(int)
-
isBroadcast
public boolean isBroadcast()
Tells if SO_BROADCAST is enabled.- Returns:
trueif SO_BROADCAST is enabled- Throws:
RuntimeIoException- If the socket is closed or if we get anSocketException- See Also:
DatagramSocket.getBroadcast()
-
setBroadcast
public void setBroadcast(boolean broadcast)
- Parameters:
broadcast- Tells if SO_BROACAST is enabled or not- See Also:
DatagramSocket.setBroadcast(boolean)
-
getSendBufferSize
public int getSendBufferSize()
- Returns:
- the size of the send buffer
- Throws:
RuntimeIoException- If the socket is closed or if we get anSocketException- See Also:
DatagramSocket.getSendBufferSize()
-
setSendBufferSize
public void setSendBufferSize(int sendBufferSize)
- Parameters:
sendBufferSize- The size of the send buffer- Throws:
RuntimeIoException- If the socket is closed or if we get anSocketException- See Also:
DatagramSocket.setSendBufferSize(int)
-
isReuseAddress
public boolean isReuseAddress()
Tells if SO_REUSEADDR is enabled.- Returns:
trueif SO_REUSEADDR is enabled- Throws:
RuntimeIoException- If the socket is closed or if we get anSocketException- See Also:
DatagramSocket.getReuseAddress()
-
setReuseAddress
public void setReuseAddress(boolean reuseAddress)
- Parameters:
reuseAddress- Tells if SO_REUSEADDR is enabled or disabled- Throws:
RuntimeIoException- If the socket is closed or if we get anSocketException- See Also:
DatagramSocket.setReuseAddress(boolean)
-
getTrafficClass
public int getTrafficClass()
Get the current Traffic Class for this Socket, if any. As this is not a mandatory feature, the returned value should be considered as a hint.- Returns:
- The Traffic Class supported by this Socket
- Throws:
RuntimeIoException- If the socket is closed or if we get anSocketException- See Also:
DatagramSocket.getTrafficClass()
-
setTrafficClass
public void setTrafficClass(int trafficClass)
- Parameters:
trafficClass- The traffic class to set, one of IPTOS_LOWCOST (0x02) IPTOS_RELIABILITY (0x04), IPTOS_THROUGHPUT (0x08) or IPTOS_LOWDELAY (0x10)- Throws:
RuntimeIoException- If the socket is closed or if we get anSocketException- See Also:
DatagramSocket.setTrafficClass(int)
-
-