Package cmion.level2
Class RemoteTCPCompetency
- java.lang.Object
-
- ion.Meta.Element
-
- cmion.architecture.CmionComponent
-
- cmion.level2.Competency
-
- cmion.level2.RemoteCompetency
-
- cmion.level2.RemoteTCPCompetency
-
- All Implemented Interfaces:
java.lang.Runnable
- Direct Known Subclasses:
ExampleTCPCompetency
public abstract class RemoteTCPCompetency extends RemoteCompetency
A class encapsulating tcp communication with another process on the network.
-
-
Field Summary
Fields Modifier and Type Field Description protected intportthe port on which to establish the tcp connection-
Fields inherited from class cmion.level2.Competency
available, competencyName, competencyType, plan, running
-
Fields inherited from class cmion.architecture.CmionComponent
architecture
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedRemoteTCPCompetency(IArchitecture architecture, int port, boolean serverMode, java.lang.String serverAddress)create a new remote TCP competency
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidinitialize()initialises the tcp connectionprotected voidsendMessage(java.lang.String message)use this method to send a message to the remotely connected competency.-
Methods inherited from class cmion.level2.RemoteCompetency
competencyCode, processMessage, returnFailure, returnSuccess, startExecution
-
Methods inherited from class cmion.level2.Competency
cancel, getCompetencyName, getCompetencyType, isAvailable, isRunning, registerHandlers, requestStartCompetency, run, runsInBackground, setAdditionalData
-
Methods inherited from class cmion.architecture.CmionComponent
getArchitecture, isConnected, onDestroy, raise
-
-
-
-
Constructor Detail
-
RemoteTCPCompetency
protected RemoteTCPCompetency(IArchitecture architecture, int port, boolean serverMode, java.lang.String serverAddress)
create a new remote TCP competency- Parameters:
architecture- a reference to the architecture objectport- the port on which we want to establish a connectionserverMode- 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 networkserverAddress- 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 Detail
-
initialize
public final void initialize()
initialises the tcp connection- Specified by:
initializein classCompetency
-
sendMessage
protected final void sendMessage(java.lang.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:
sendMessagein classRemoteCompetency
-
-