Class DatagramSocketOptions


  • public class DatagramSocketOptions
    extends NetworkOptions
    Options used to configure a datagram socket.
    Author:
    Tim Fox
    • Field Detail

      • DEFAULT_BROADCAST

        public static final boolean DEFAULT_BROADCAST
        The default value of broadcast for the socket = false
        See Also:
        Constant Field Values
      • DEFAULT_LOOPBACK_MODE_DISABLED

        public static final boolean DEFAULT_LOOPBACK_MODE_DISABLED
        The default value of loopback disabled = true
        See Also:
        Constant Field Values
      • DEFAULT_MULTICAST_TIME_TO_LIVE

        public static final int DEFAULT_MULTICAST_TIME_TO_LIVE
        The default value of multicast disabled = -1
        See Also:
        Constant Field Values
      • DEFAULT_MULTICAST_NETWORK_INTERFACE

        public static final String DEFAULT_MULTICAST_NETWORK_INTERFACE
        The default value of multicast network interface = null
      • DEFAULT_REUSE_ADDRESS

        public static final boolean DEFAULT_REUSE_ADDRESS
        The default value of reuse address = false
        See Also:
        Constant Field Values
      • DEFAULT_IPV6

        public static final boolean DEFAULT_IPV6
        The default value of use IP v6 = false
        See Also:
        Constant Field Values
    • Constructor Detail

      • DatagramSocketOptions

        public DatagramSocketOptions()
        Default constructor
      • DatagramSocketOptions

        public DatagramSocketOptions​(DatagramSocketOptions other)
        Copy constructor
        Parameters:
        other - the options to copy
      • DatagramSocketOptions

        public DatagramSocketOptions​(JsonObject json)
        Constructor to create options from JSON
        Parameters:
        json - the JSON
    • Method Detail

      • getSendBufferSize

        public int getSendBufferSize()
        Description copied from class: NetworkOptions
        Return the TCP send buffer size, in bytes.
        Overrides:
        getSendBufferSize in class NetworkOptions
        Returns:
        the send buffer size
      • setSendBufferSize

        public DatagramSocketOptions setSendBufferSize​(int sendBufferSize)
        Description copied from class: NetworkOptions
        Set the TCP send buffer size
        Overrides:
        setSendBufferSize in class NetworkOptions
        Parameters:
        sendBufferSize - the buffers size, in bytes
        Returns:
        a reference to this, so the API can be used fluently
      • getReceiveBufferSize

        public int getReceiveBufferSize()
        Description copied from class: NetworkOptions
        Return the TCP receive buffer size, in bytes
        Overrides:
        getReceiveBufferSize in class NetworkOptions
        Returns:
        the receive buffer size
      • setReceiveBufferSize

        public DatagramSocketOptions setReceiveBufferSize​(int receiveBufferSize)
        Description copied from class: NetworkOptions
        Set the TCP receive buffer size
        Overrides:
        setReceiveBufferSize in class NetworkOptions
        Parameters:
        receiveBufferSize - the buffers size, in bytes
        Returns:
        a reference to this, so the API can be used fluently
      • setReuseAddress

        public DatagramSocketOptions setReuseAddress​(boolean reuseAddress)
        Description copied from class: NetworkOptions
        Set the value of reuse address
        Overrides:
        setReuseAddress in class NetworkOptions
        Parameters:
        reuseAddress - the value of reuse address
        Returns:
        a reference to this, so the API can be used fluently
      • setReusePort

        public DatagramSocketOptions setReusePort​(boolean reusePort)
        Description copied from class: NetworkOptions
        Set the value of reuse port.

        This is only supported by native transports.

        Overrides:
        setReusePort in class NetworkOptions
        Parameters:
        reusePort - the value of reuse port
        Returns:
        a reference to this, so the API can be used fluently
      • setTrafficClass

        public DatagramSocketOptions setTrafficClass​(int trafficClass)
        Description copied from class: NetworkOptions
        Set the value of traffic class
        Overrides:
        setTrafficClass in class NetworkOptions
        Parameters:
        trafficClass - the value of traffic class
        Returns:
        a reference to this, so the API can be used fluently
      • isBroadcast

        public boolean isBroadcast()
        Returns:
        true if the socket can send or receive broadcast packets?
      • setBroadcast

        public DatagramSocketOptions setBroadcast​(boolean broadcast)
        Set if the socket can send or receive broadcast packets
        Parameters:
        broadcast - true if the socket can send or receive broadcast packets
        Returns:
        a reference to this, so the API can be used fluently
      • isLoopbackModeDisabled

        public boolean isLoopbackModeDisabled()
        Returns:
        true if loopback mode is disabled
      • setLoopbackModeDisabled

        public DatagramSocketOptions setLoopbackModeDisabled​(boolean loopbackModeDisabled)
        Set if loopback mode is disabled
        Parameters:
        loopbackModeDisabled - true if loopback mode is disabled
        Returns:
        a reference to this, so the API can be used fluently
      • getMulticastTimeToLive

        public int getMulticastTimeToLive()
        Returns:
        the multicast ttl value
      • setMulticastTimeToLive

        public DatagramSocketOptions setMulticastTimeToLive​(int multicastTimeToLive)
        Set the multicast ttl value
        Parameters:
        multicastTimeToLive - the multicast ttl value
        Returns:
        a reference to this, so the API can be used fluently
      • getMulticastNetworkInterface

        public String getMulticastNetworkInterface()
        Get the multicast network interface address
        Returns:
        the interface address
      • setMulticastNetworkInterface

        public DatagramSocketOptions setMulticastNetworkInterface​(String multicastNetworkInterface)
        Set the multicast network interface address
        Parameters:
        multicastNetworkInterface - the address
        Returns:
        a reference to this, so the API can be used fluently
      • isIpV6

        public boolean isIpV6()
        Returns:
        true if IP v6 be used?
      • setIpV6

        public DatagramSocketOptions setIpV6​(boolean ipV6)
        Set if IP v6 should be used
        Parameters:
        ipV6 - true if IP v6 should be used
        Returns:
        a reference to this, so the API can be used fluently
      • setLogActivity

        public DatagramSocketOptions setLogActivity​(boolean logEnabled)
        Description copied from class: NetworkOptions
        Set to true to enabled network activity logging: Netty's pipeline is configured for logging on Netty's logger.
        Overrides:
        setLogActivity in class NetworkOptions
        Parameters:
        logEnabled - true for logging the network activity
        Returns:
        a reference to this, so the API can be used fluently
      • setActivityLogDataFormat

        public DatagramSocketOptions setActivityLogDataFormat​(ByteBufFormat activityLogDataFormat)
        Description copied from class: NetworkOptions
        Set the value of Netty's logging handler's data format: Netty's pipeline is configured for logging on Netty's logger.
        Overrides:
        setActivityLogDataFormat in class NetworkOptions
        Parameters:
        activityLogDataFormat - the format to use
        Returns:
        a reference to this, so the API can be used fluently