Skip to content

TCP connections

TCP arrives as the plugin tcp. It brings its own Python process (Python 3.11 or newer) and needs the net:socket permission in its manifest. Install and switch it on under Settings → Plugins; TCP is then offered on the connections page.

TCP is a stream without boundaries. There are no messages, there are bytes. Where one telegram ends is yours to define — through a delimiter, or failing that through a pause.

Field Meaning
Role Client opens the connection, Server accepts it. Client when the machine listens, server when the machine calls in by itself
Host client only: the peer, host name or IP address
Bind address server only: the local interface. 0.0.0.0 takes every one, 127.0.0.1 only the local one
Port the peer’s port as a client, the port to listen on as a server
Delimiter LF, CRLF, CR, NUL, ETX or none
Encoding UTF-8, Latin-1, ASCII or hex
Silence fallback (ms) default 250
Message limit (bytes) default 65536
Backoff, shortest / longest wait (ms) client only, default 500 and 30000

Encoding. For a binary protocol pick hex. Every byte then stays readable instead of being replaced during conversion.

Silence fallback. Only in play with no delimiter, or when one never arrives: whatever came in before this much silence counts as one message. Set too low it cuts a telegram in half wherever the sender pauses.

Message limit. Upper bound for one telegram. Exceeded without a delimiter, the buffer is dropped instead of growing without end.

Backoff. The wait before a reconnect doubles up to the cap. A machine that is switched off is not knocked on every second.

A TCP tag has exactly one field, Channel:

Channel What the tag carries
data the payload — the telegram itself
connected the connection state
lastError the most recent fault
rxCount telegrams received
txCount telegrams sent

Only data carries payload. The other four describe the connection itself and are read only — they make good tiles on a dashboard when somebody has to keep an eye on whether a machine is still talking.

TCP can write. A tag on channel data whose direction is Writes to the machine or Both sends its value as a telegram. The write counts as successful only once the sidecar process has acknowledged it.