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
Define the configuration for a Datagram based session.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionNioDatagramSessionConfig(DatagramChannel channel) Creates a new instance of NioDatagramSessionConfig, associated with the given DatagramChannel. -
Method Summary
Modifier and TypeMethodDescriptionintGet the Socket receive buffer size for this DatagramChannel.intintGet the current Traffic Class for this Socket, if any.booleanTells if SO_BROADCAST is enabled.booleanTells 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 AbstractDatagramSessionConfig
isBroadcastChanged, isCloseOnPortUnreachable, isReceiveBufferSizeChanged, isReuseAddressChanged, isSendBufferSizeChanged, isTrafficClassChanged, setAll, setCloseOnPortUnreachableMethods inherited from class 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, setWriteTimeoutMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface 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
-
Field Details
-
channel
The associated channel
-
-
Constructor Details
-
NioDatagramSessionConfig
NioDatagramSessionConfig(DatagramChannel channel) Creates a new instance of NioDatagramSessionConfig, associated with the given DatagramChannel.- Parameters:
channel- The associated DatagramChannel
-
-
Method Details
-
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:
-
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:
-
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:
-
setBroadcast
public void setBroadcast(boolean broadcast) - Parameters:
broadcast- Tells if SO_BROACAST is enabled or not- See Also:
-
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:
-
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:
-
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:
-
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:
-
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:
-
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:
-