Class BasicTCP

    • Field Detail

      • reaper_interval

        protected long reaper_interval
      • conn_expire_time

        protected long conn_expire_time
      • recv_buf_size

        protected int recv_buf_size
      • send_buf_size

        protected int send_buf_size
      • sock_conn_timeout

        protected int sock_conn_timeout
      • peer_addr_read_timeout

        protected int peer_addr_read_timeout
      • max_length

        protected int max_length
      • tcp_nodelay

        protected boolean tcp_nodelay
      • linger

        protected int linger
      • client_bind_addr

        protected java.net.InetAddress client_bind_addr
      • client_bind_port

        protected int client_bind_port
      • defer_client_bind_addr

        protected boolean defer_client_bind_addr
    • Constructor Detail

      • BasicTCP

        protected BasicTCP()
    • Method Detail

      • supportsMulticasting

        public boolean supportsMulticasting()
        Description copied from class: TP
        Whether or not hardware multicasting is supported
        Specified by:
        supportsMulticasting in class TP
      • getReaperInterval

        public long getReaperInterval()
      • setReaperInterval

        public BasicTCP setReaperInterval​(long interval)
      • reaperInterval

        public BasicTCP reaperInterval​(long interval)
      • getConnExpireTime

        public long getConnExpireTime()
      • setConnExpireTime

        public BasicTCP setConnExpireTime​(long time)
      • getRecvBufSize

        public int getRecvBufSize()
      • setRecvBufSize

        public BasicTCP setRecvBufSize​(int r)
      • getSendBufSize

        public int getSendBufSize()
      • setSendBufSize

        public BasicTCP setSendBufSize​(int s)
      • getSockConnTimeout

        public int getSockConnTimeout()
      • setSockConnTimeout

        public BasicTCP setSockConnTimeout​(int s)
      • getMaxLength

        public int getMaxLength()
      • setMaxLength

        public BasicTCP setMaxLength​(int len)
      • getPeerAddrReadTimeout

        public int getPeerAddrReadTimeout()
      • setPeerAddrReadTimeout

        public BasicTCP setPeerAddrReadTimeout​(int p)
      • tcpNodelay

        public boolean tcpNodelay()
      • tcpNodelay

        public BasicTCP tcpNodelay​(boolean t)
      • getLinger

        public int getLinger()
      • setLinger

        public BasicTCP setLinger​(int l)
      • getClientBindAddr

        public java.net.InetAddress getClientBindAddr()
      • setClientBindAddr

        public BasicTCP setClientBindAddr​(java.net.InetAddress c)
      • getClientBindPort

        public int getClientBindPort()
      • setClientBindPort

        public BasicTCP setClientBindPort​(int c)
      • deferClientBindAddr

        public boolean deferClientBindAddr()
      • deferClientBindAddr

        public BasicTCP deferClientBindAddr​(boolean d)
      • init

        public void init()
                  throws java.lang.Exception
        Description copied from class: Protocol
        Called after instance has been created (null constructor) and before protocol is started. Properties are already set. Other protocols are not yet connected and events cannot yet be sent.
        Overrides:
        init in class TP
        Throws:
        java.lang.Exception - Thrown if protocol cannot be initialized successfully. This will cause the ProtocolStack to fail, so the channel constructor will throw an exception
      • sendMulticast

        public void sendMulticast​(byte[] data,
                                  int offset,
                                  int length)
                           throws java.lang.Exception
        Description copied from class: TP
        Send to all members in the group. UDP would use an IP multicast message, whereas TCP would send N messages, one for each member
        Specified by:
        sendMulticast in class TP
        Parameters:
        data - The data to be sent. This is not a copy, so don't modify it
        Throws:
        java.lang.Exception
      • sendUnicast

        public void sendUnicast​(PhysicalAddress dest,
                                byte[] data,
                                int offset,
                                int length)
                         throws java.lang.Exception
        Description copied from class: TP
        Send a unicast to 1 member. Note that the destination address is a *physical*, not a logical address
        Specified by:
        sendUnicast in class TP
        Parameters:
        dest - Must be a non-null unicast address
        data - The data to be sent. This is not a copy, so don't modify it
        Throws:
        java.lang.Exception
      • getInfo

        public java.lang.String getInfo()
        Specified by:
        getInfo in class TP
      • printConnections

        public abstract java.lang.String printConnections()
      • send

        public abstract void send​(Address dest,
                                  byte[] data,
                                  int offset,
                                  int length)
                           throws java.lang.Exception
        Throws:
        java.lang.Exception
      • retainAll

        public abstract void retainAll​(java.util.Collection<Address> members)
      • receive

        public void receive​(Address sender,
                            java.nio.ByteBuffer buf)
        Description copied from interface: Receiver
        Delivers a message from a given sender to the application
        Specified by:
        receive in interface Receiver
        Parameters:
        sender - The sender of the message
        buf - The buffer. An application typically de-serializes data from the buffer into objects used by the application. Note that when receive() returns, it is not safe to use the buffer any longer; if an application needs to use a buffer after this callback returns, it must make a copy.

        Note that buf could be a direct ByteBuffer.

      • down

        public java.lang.Object down​(Event evt)
        Description copied from class: Protocol
        An event is to be sent down the stack. A protocol may want to examine its type and perform some action on it, depending on the event's type. If the event is a message MSG, then the protocol may need to add a header to it (or do nothing at all) before sending it down the stack using down_prot.down().
        Overrides:
        down in class TP