Skip to content
Legacy docs for Tenzir v5.x. For the latest Tenzir v6 series, visit docs.tenzir.com. Migrating from v5? Read the Tenzir v6 migration guide.

The Transmission Control Protocol (TCP) provides a bidirectional byte stream over IP. Tenzir supports reading from and writing to TCP sockets in both server (listening) and client (connect) mode.

ServerconnectSend (listen)Clienttcp://1.2.3.4Send (connect)tcp://1.2.3.4tcp://5.6.7.8tcp://5.6.7.8Receive (connect)Receive (listen)

Use the IP address 0.0.0.0 to listen on all available network interfaces.

To enable TLS, use tls=true. You can optionally pass a PEM-encoded certificate and private key via the certfile and keyfile options.

For testing purposes, you can quickly generate a self-signed certificate as follows:

Terminal window
openssl req -x509 -newkey rsa:2048 -keyout key_and_cert.pem -out key_and_cert.pem -days 365 -nodes

An easy way to test a TLS connection is to try connecting via OpenSSL:

Terminal window
openssl s_client 127.0.0.1:443

Read data by connecting to a remote TCP server

Section titled “Read data by connecting to a remote TCP server”
from "tcp://127.0.0.1:443", connect=true {
read_json
}

Read data by listen on localhost with TLS enabled

Section titled “Read data by listen on localhost with TLS enabled”
from "tcp://127.0.0.1:443", tls=true, certfile="cert.pem", keyfile="key.pem" {
read_json
}

Last updated: