Class TcpTransport

java.lang.Object
org.jgroups.tests.rt.transports.TcpTransport
All Implemented Interfaces:
RtTransport

public class TcpTransport extends Object implements RtTransport
Since:
4.0
  • Field Details

    • srv_sock

      protected ServerSocket srv_sock
    • sock

      protected Socket sock
    • output

      protected OutputStream output
    • input

      protected InputStream input
    • receiver_thread

      protected TcpTransport.Receiver receiver_thread
    • receiver

      protected RtReceiver receiver
    • host

      protected InetAddress host
    • port

      protected int port
    • out_buf_size

      protected int out_buf_size
    • in_buf_size

      protected int in_buf_size
    • server

      protected boolean server
    • tcp_nodelay

      protected boolean tcp_nodelay
    • log

      protected final Log log
  • Constructor Details

    • TcpTransport

      public TcpTransport()
  • Method Details

    • options

      public String[] options()
      Description copied from interface: RtTransport
      Prints the accepted options, e.g. [-host host] [-port port] [-server host]
      Specified by:
      options in interface RtTransport
      Returns:
    • options

      public void options(String... options) throws Exception
      Description copied from interface: RtTransport
      Sets options on this transport. Usually done after creation and before RtTransport.start(String...) is called, but may also be called at runtime.
      Specified by:
      options in interface RtTransport
      Parameters:
      options - The options
      Throws:
      Exception
    • receiver

      public void receiver(RtReceiver receiver)
      Description copied from interface: RtTransport
      Sets the receiver whose RtReceiver.receive(Object,byte[],int,int) callback will be invoked whenever a message is received
      Specified by:
      receiver in interface RtTransport
      Parameters:
      receiver -
    • localAddress

      public Object localAddress()
      Description copied from interface: RtTransport
      Returns the local addres of this member.
      Specified by:
      localAddress in interface RtTransport
      Returns:
      The local address. Implementations without cluster membership may return null
    • clusterMembers

      public List<? extends Object> clusterMembers()
      Description copied from interface: RtTransport
      Returns the addresses of all cluster members. May return null if not implemented
      Specified by:
      clusterMembers in interface RtTransport
      Returns:
      The list of all members in the cluster
    • start

      public void start(String... options) throws Exception
      Description copied from interface: RtTransport
      Starts the transport, e.g. connecting to a server socket
      Specified by:
      start in interface RtTransport
      Parameters:
      options - Options passed to the transport at startup time. May be null
      Throws:
      Exception
    • stop

      public void stop()
      Description copied from interface: RtTransport
      Stops the transport, e.g. stopping the accept() loop in a TCP-based server
      Specified by:
      stop in interface RtTransport
    • send

      public void send(Object dest, byte[] buf, int offset, int length) throws Exception
      Description copied from interface: RtTransport
      Sends a message
      Specified by:
      send in interface RtTransport
      Parameters:
      dest - The destination address
      buf - The buffer
      offset - The offset at which the data starts
      length - The length (in bytes) of the data to send
      Throws:
      Exception
    • doSend

      public void doSend(byte[] buf, int offset, int length) throws Exception
      Throws:
      Exception
    • flush

      public void flush() throws IOException
      Throws:
      IOException