Class TcpDatagramSocket

    • Field Detail

      • IO_EXCEPTIONS_LOG_LEVEL

        public static final int IO_EXCEPTIONS_LOG_LEVEL
        Debbuging flag for logging an IO exceptions which occur, set to a negative to disable the logging.
    • Constructor Detail

      • TcpDatagramSocket

        public TcpDatagramSocket()
                          throws SocketException
        Create a new TcpDatagramSocket that with a wildcard address bound to an ephemeral port.
        Throws:
        SocketException - if any error happens during the bind, or if the port is unavailable
      • TcpDatagramSocket

        public TcpDatagramSocket​(SocketAddress addr)
                          throws SocketException
        Creates a new TcpDatagramSocket which will be bound to the specified address.
        Parameters:
        addr - the address to bind
        Throws:
        SocketException - if any error happens during the bind, or if the port is unavailable
      • TcpDatagramSocket

        public TcpDatagramSocket​(int nPort)
                          throws SocketException
        Creates a new TcpDatagramSocket using the wildcard address and the specified port.

        The port number should be between 0 and 65535. Zero means that the system will pick an ephemeral port during the bind operation.

        Parameters:
        nPort - the port to bind to
        Throws:
        SocketException - if any error happens during the bind, or if the port is unavailable
      • TcpDatagramSocket

        public TcpDatagramSocket​(int nPort,
                                 InetAddress addr)
                          throws SocketException
        Creates a new TcpDatagramSocket using an address and a port number.

        If null is specified as the address assigned will be the wildcard address.

        The port number should be between 0 and 65535. Zero means that the system will pick an ephemeral port during the bind operation.

        Parameters:
        nPort - the port number
        addr - the IP address
        Throws:
        SocketException - if any error happens during the bind, or if the port is unavailable
      • TcpDatagramSocket

        public TcpDatagramSocket​(com.oracle.coherence.common.net.SocketProvider provider)
                          throws SocketException
        Creates a new TcpDatagramSocket using the provider.
        Parameters:
        provider - the provider to be used
        Throws:
        SocketException - if any error happens during the bind, or if the port is unavailable
    • Method Detail

      • setSocketOptions

        public void setSocketOptions​(SocketOptions options)
                              throws SocketException
        Specify SocketOptions to be used to configure each of the underlying TCP sockets. These options will be added to any previously specified options.
        Parameters:
        options - the SocketOptions
        Throws:
        SocketException - if the options fail to be set
      • setListenBacklog

        public void setListenBacklog​(int n)
                              throws IOException
        Specify the listen backlog for the server socket.
        Parameters:
        n - the depth of the backlog, or <=0 for the OS default.
        Throws:
        IOException - if the port is unavailable
      • setPacketMagic

        public void setPacketMagic​(int nMagic,
                                   int nMask)
                            throws IOException
        Specify the packet header which is included at the start of every packet. Because this implementation is TCP based these headers can be stripped off, and replaced on the far side without consuming any network resources.
        Parameters:
        nMagic - the packet header
        nMask - the packet header bitmask identifying the bits used
        Throws:
        IOException - if the port is unavailable
      • setAdvanceFrequency

        public void setAdvanceFrequency​(int nAdvance)
        Specify the frequency at which the DatagramSocket will advance over the sub-sockets during receive. A higher value will optimize for throughput as well as latency when communicating with a small number of peers. A low value will optimize for latency when communicating with a large number of peers, but is likely to hurt overall throughput.
        Parameters:
        nAdvance - the packet frequency at which to advance between peers