The TCP API

The TCP API is provided by the NY_TcpPlugIn and serves as the central interface for managing TCP connections (both server and client) for cross-platform message exchange within and outside the nyssr.net segment.

Communication Mechanism

The entire management process—from creation and deletion to status querying of TCP servers and clients—is performed by sending specific Records to a dedicated Nanoservice within the SYSTEM namespace.

Addressing the Nanoservice

To send a command to the TCP API, a CEnvelope must be used to correctly address the target Nanoservice. This is necessary for services on the same node (local) as well as on different nodes (remote).

1. Local Addressing (Same Node): The message is sent to a Nanoservice on the local node.

// Addressing for a local Nanoservice
final CEnvelope env1 = CEnvelope.forLocalNanoService(CRecordTcpCreateClient.class);

2. Remote Addressing (Different Node): The message is sent to a Nanoservice on another specific node.

// Addressing for a remote Nanoservice on another node
final CEnvelope env2 = CEnvelope.forRemoteNanoService(CRecordTcpCreateClient.class,
                                                      new CNodeAddress(new CNodeId("MyNode")));

API Records in Detail

The TCP API utilizes various Record types for control, notification, and data transfer.

1. Management Records (Control Commands)

These records are used to create, delete, and query the status of active TCP components.

Record Description
CRecordTcpCreateServer Creates a new TCP Server to accept incoming connections for message exchange.
CRecordTcpDeleteServer Destroys or closes an existing TCP Server.
CRecordTcpCreateClient Creates a new TCP Client and establishes an outgoing connection for message exchange.
CRecordTcpDeleteClient Destroys or closes an existing TCP Client connection.
CRecordTcpGetServerList Retrieves a list of all currently existing TCP Servers.
CRecordTcpGetClientList Retrieves a list of all currently existing TCP Client connections.

2. Notification Records (Asynchronous Feedback)

These records inform about state changes of the TCP components.

Record Description
CRecordTcpNotifyServerCreated Notification about the successful creation of a new TCP Server.
CRecordTcpNotifyServerDeleted Notification about the deletion/closure of a TCP Server.
CRecordTcpNotifyClientCreated Notification about the successful establishment of a TCP Client connection.
CRecordTcpNotifyClientDeleted Notification about the closure of a TCP Client connection.
CRecordTcpCreateClientRetry Notification that the TCP Client is making a new connection attempt.

3. Data Records (Descriptions)

These records contain descriptive information and metadata about the active TCP components.

Record Description
CRecordTcpServer Detailed description and metadata of an active TCP Server.
CRecordTcpClient Detailed description and metadata of an active TCP Client connection.

See also