Package cmion.level2

Class RemoteTCPCompetency

All Implemented Interfaces:
Runnable
Direct Known Subclasses:
ExampleTCPCompetency

public abstract class RemoteTCPCompetency extends RemoteCompetency
A class encapsulating tcp communication with another process on the network.
  • Field Details

    • port

      protected int port
      the port on which to establish the tcp connection
  • Constructor Details

    • RemoteTCPCompetency

      protected RemoteTCPCompetency(IArchitecture architecture, int port, boolean serverMode, String serverAddress)
      create a new remote TCP competency
      Parameters:
      architecture - a reference to the architecture object
      port - the port on which we want to establish a connection
      serverMode - if true, we act as a server and listen for a remote program to connect, if false, we assume the role of a client and connect to a server on the network
      serverAddress - if serverMode is false this tells us the server address we have to connect to, if serverMode is true this parameter is not used (can be null)
  • Method Details

    • initialize

      public final void initialize()
      initialises the tcp connection
      Specified by:
      initialize in class Competency
    • sendMessage

      protected final void sendMessage(String message)
      use this method to send a message to the remotely connected competency. Call it typically from the startExecution method or from an event handler
      Specified by:
      sendMessage in class RemoteCompetency