Class BasicTCP

Direct Known Subclasses:
TCP, TCP_NIO

public abstract class BasicTCP extends TP
Shared base class for tcpip protocols
Author:
Scott Marlow
  • Field Details

    • external_addr

      protected InetAddress external_addr
    • start_port

      protected int start_port
    • end_port

      protected int end_port
    • reaper_interval

      protected long reaper_interval
    • conn_expire_time

      protected long conn_expire_time
  • Constructor Details

    • BasicTCP

      public BasicTCP()
  • Method Details

    • getStartPort

      public int getStartPort()
    • setStartPort

      public void setStartPort(int start_port)
    • getEndPort

      public int getEndPort()
    • setEndPort

      public void setEndPort(int end_port)
    • getReaperInterval

      public long getReaperInterval()
    • setReaperInterval

      public void setReaperInterval(long reaper_interval)
    • getConnExpireTime

      public long getConnExpireTime()
    • setConnExpireTime

      public void setConnExpireTime(long conn_expire_time)
    • setProperties

      public boolean setProperties(Properties props)
      Description copied from class: TP
      Setup the Protocol instance according to the configuration string
      Overrides:
      setProperties in class TP
      Returns:
      true if no other properties are left. false if the properties still have data in them, ie , properties are left over and not handled by the protocol stack
    • init

      public void init() throws 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:
      Exception - Thrown if protocol cannot be initialized successfully. This will cause the ProtocolStack to fail, so the channel constructor will throw an exception
    • sendToAllMembers

      public void sendToAllMembers(byte[] data, int offset, int length) throws 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:
      sendToAllMembers in class TP
      Parameters:
      data - The data to be sent. This is not a copy, so don't modify it
      offset -
      length -
      Throws:
      Exception
    • sendToSingleMember

      public void sendToSingleMember(Address dest, byte[] data, int offset, int length) throws 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:
      sendToSingleMember 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
      offset -
      length -
      Throws:
      Exception
    • getInfo

      public String getInfo()
      Specified by:
      getInfo in class TP
    • postUnmarshalling

      public void postUnmarshalling(Message msg, Address dest, Address src, boolean multicast)
      Specified by:
      postUnmarshalling in class TP
    • postUnmarshallingList

      public void postUnmarshallingList(Message msg, Address dest, boolean multicast)
      Specified by:
      postUnmarshallingList in class TP
    • printConnections

      public abstract String printConnections()
    • send

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

      public abstract void retainAll(Collection<Address> members)
    • receive

      public void receive(Address sender, byte[] data, int offset, int length)
      ConnectionTable.Receiver interface
    • handleDownEvent

      protected Object handleDownEvent(Event evt)
      Overrides:
      handleDownEvent in class TP