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

    • reaper_interval

      protected long reaper_interval
    • conn_expire_time

      protected long conn_expire_time
  • Constructor Details

    • BasicTCP

      protected BasicTCP()
  • Method Details

    • 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 void setReaperInterval(long reaper_interval)
    • getConnExpireTime

      public long getConnExpireTime()
    • setConnExpireTime

      public void setConnExpireTime(long conn_expire_time)
    • 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
    • sendMulticast

      public void sendMulticast(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:
      sendMulticast in class TP
      Parameters:
      data - The data to be sent. This is not a copy, so don't modify it
      offset -
      length -
      Throws:
      Exception
    • sendUnicast

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

      public String getInfo()
      Specified by:
      getInfo 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)
      ConnectionMap.Receiver interface
      Overrides:
      receive in class TP
      Parameters:
      sender -
      data -
      offset -
      length -
    • handleDownEvent

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