Source TCP
Purpose
Defines the parameters for receiving data over a TCP connection.
TCP is a connection-oriented (stateful) protocol — unlike UDP, a TCP connection is established before data transfer begins, and both endpoints maintain state throughout the session. This makes TCP suitable for reliable, ordered data streams where message boundaries need to be preserved.
This Asset can be used by:
| Asset type | Link |
|---|---|
| Input Processors | Stream Input Processor |
| Output Processors | Stream Output Processor |
Prerequisite
None. The TCP Source defines its own connection parameters directly — no separate Connection asset is required.
Configuration
Name & Description
-
Name: Name of the Asset. Spaces are not allowed in the name. -
Description: Enter a description.
Inheritance chain of this Asset — If this Asset extends another, the inheritance chain is shown here. Click to navigate to any parent Asset in the chain.
Asset Usage: If the Asset is used by other Assets, the Asset Usage box shows how many times this Asset is used and which parts are referencing it. Otherwise it is not shown. Click to expand and then click to follow, if any.
Required Roles
In case you are deploying to a Cluster which is running (a) Reactive Engine Nodes which have (b) specific Roles
configured, then you can restrict use of this Asset to those Nodes with matching
roles.
If you want this restriction, then enter the names of the Required Roles here. Otherwise, leave empty to match all
Nodes (no restriction).
Host
Bind host: The network interface address on which the TCP Source listens. Leave empty to bind to all interfaces.Bind port: The TCP port number on which to listen for incoming connections.
Advanced Parameters
Connection backlog: Number of pending connections the operating system holds in the queue while waiting for acceptance. Increase this value if many clients connect simultaneously.Receive buffer size [bytes]: Size of the socket's receive buffer in bytes. Set to0to use the operating system default. Set to a specific value to control memory usage for high-throughput scenarios.Idle timeout [sec]: Number of seconds after which an idle connection is automatically closed. If0, connections are held open indefinitely.
Example: IoT Sensor Data over TCP
This example shows how to receive continuous temperature and humidity readings from IoT sensors connected over TCP.
Incoming Data Format
Each sensor sends newline-delimited JSON records:
{"sensor_id":"SENS-001","timestamp":"2026-03-27T08:00:00Z","temperature":22.4,"humidity":61.2}
{"sensor_id":"SENS-001","timestamp":"2026-03-27T08:00:05Z","temperature":22.5,"humidity":61.0}
{"sensor_id":"SENS-002","timestamp":"2026-03-27T08:00:00Z","temperature":18.7,"humidity":74.1}
Each line is a complete, independent JSON object. A newline character (\n) acts as the record boundary — no special framing is needed beyond that.
TCP Source Configuration
| Setting | Value | Reason |
|---|---|---|
| Bind host | acme.sensor.host | Hostname of the machine running the Reactive Engine |
| Bind port | 9000 | Fixed port number — sensors are configured to connect here |
| Connection backlog | 50 | Queue depth for incoming connection requests |
| Receive buffer size | 65536 | 64 KB socket receive buffer |
| Idle timeout | 300 | 5-minute idle timeout — closes dead connections |
Workflow Wiring
- TCP Source (
IoTSensorSource) — binds to0.0.0.0:9000and accepts incoming sensor connections - Stream Input Processor — reads the raw byte stream and forwards it to the next processor
- Mapping Processor — parses each newline-delimited JSON record, applies a schema, and maps fields to the output format
- File Sink — writes the processed records to a log file
Key Design Notes
- No polling interval — TCP streams are push-based. The sensor pushes data as it is available; the engine reads continuously without asking.
- Message boundaries — TCP itself is a stream protocol with no concept of record boundaries. Use a Format with a delimiter (e.g., newline) or a fixed-length framing to split the byte stream into logical records.
- Connection handling — if a sensor disconnects and reconnects, layline.io handles the reconnection automatically. Set the Idle timeout to clean up sensors that stop sending without closing the connection properly.
- Multiple sensors — multiple sensors can connect to the same port simultaneously. Each independent TCP connection carries its own stream of records.
Please note, that the creation of the online documentation is Work-In-Progress. It is constantly being updated. should you have questions or suggestions, please don't hesitate to contact us at support@layline.io .