Skip to content

TCP & UDP

TCP and UDP requests talk to a server below HTTP: you connect, send messages from the composer and see every byte that comes back. Use them for line protocols (Redis, SMTP, custom daemons), binary protocols with length prefixes, game or IoT servers, and anything else that isn’t HTTP.

In the Collection sidebar, open the New menu (+) and choose New TCP connection.

AddressConnection
tcp://host:portPlain TCP.
tls://host:port (or ssl://host:port)TCP with TLS.
host:portNo scheme means tcp://.

The port is required. {{variables}} work in the address.

Press Connect. The log shows Connected · TCP · 127.0.0.1:9000 · 2 ms (with the TLS version for tls://, for example TCP + TLS 1.3). Disconnect first lets messages still being written go out (for up to 5 seconds), then closes the connection. When the server closes it, the log says Disconnected (Closed by server); bytes of an unfinished message are shown as a last message first.

  • Proxy: when an HTTP proxy applies to the host, the connection goes through a CONNECT tunnel.
  • TLS: verified with this computer’s trusted certificates and Settings → Certificates (including a client certificate). Turn verification off with Verify TLS certificates in the request’s Settings tab. No ALPN protocol is offered.
  • Timeout: the connect timeout from Settings applies.

Choose New UDP socket. The address is udp://host:port (or host:port).

Connect only opens a local socket: nothing is sent until your first message, because UDP has no handshake. When the host name has both IPv4 and IPv6 addresses, IPv4 is used (local servers usually listen on 127.0.0.1 while localhost may resolve to ::1 first).

  • Each message you send is one datagram to the target.
  • Every datagram that arrives on the socket is shown with its sender, also from other addresses (for example answers to a broadcast).
  • Allow broadcast addresses (e.g. 255.255.255.255) in the Options tab lets you send to broadcast addresses.
  • UDP never uses a proxy; proxy settings are ignored.
  • A datagram holds at most 65,507 bytes. Your system may allow less (macOS allows 9,216 bytes by default); the error then comes from the system.
  • When the target sends back an ICMP “port unreachable”, the log shows Nothing is listening at 127.0.0.1:9001 (port unreachable). The socket stays open.

The composer has three modes:

ModeSends{{variables}}Line ending added
TextThe text as UTF-8ReplacedYes (if set)
JSONThe text as UTF-8, with JSON highlightingReplacedYes (if set)
BinaryBytes: typed in Hex, streamed from a File, or recorded from the MicrophoneNot replacedNever

Hex bytes may be written as 48 65 6c 6c 6f, 48656c6c6f, 48:65:6c or 0x48,0x65. Press Send or Mod+Enter.

The arrow next to Send (More ways to send) sends the composer’s message again and again: Send every second, Send every 5 seconds, Send every 30 seconds, or Send every… at a pace you type in milliseconds (10 or more). While it repeats, the composer shows Sending every 5 s and a Stop button. {{variables}} in text are filled in fresh for each send, so temp={{$randomInt(10, 30)}} sends a new reading every time. Repeating runs in Zorvik itself, so it keeps its pace when the window is in the background; it stops when you press Stop or the connection closes.

File and Microphone work as for WebSocket: each piece is one message (one datagram on UDP, which carries at most 65,507 bytes). With length-prefix framing, each piece gets its own prefix, so it must fit the prefix size.

Received messages are shown as text when they are valid UTF-8, otherwise as hex. Click a row to see the whole message. The log’s filter, View menu and Export the log… work as for WebSocket; Save to a file saves a binary message.

The Options tab controls how messages are cut and what is added to them.

SettingAppended
Nothing (default)nothing
\n (LF)a line feed
\r\n (CRLF)carriage return + line feed

It applies to Text and JSON messages, on TCP and UDP. Binary messages are sent exactly as typed.

TCP is a stream of bytes; it doesn’t keep message boundaries. Message framing decides how Zorvik cuts incoming bytes into messages, and what it adds to the messages you send.

FramingIncoming bytesMessages you send
As they arrive (default)Each chunk read from the socket is one message (up to 64 KB). One message from the server may show as several chunks, or several as one.Sent as they are.
One message per lineSplit at \n; a \r before it is dropped. A line longer than 16 MB is cut into pieces.Sent as they are: choose a line ending above, the framing doesn’t add one.
Length prefix (big-endian)Each message starts with its length as a big-endian number of Prefix size bytes (1, 2 or 4). A length over 16 MB closes the connection.The same prefix is added. A message too long for the prefix (over 255 bytes for 1 byte, 65,535 for 2) is refused with an error.

The line ending is added before the prefix, so the prefix counts it.

UDP has no framing: one datagram is always one message.

Coding agents connected through zorvik mcp can open TCP and UDP connections with open_connection, then send with send_message (text, JSON or hex), wait for a reply with wait_for_message and read the log with read_messages. See Tools.

requests/Redis ping.yaml
name: Redis ping
kind: tcp
url: tcp://localhost:6379
socket:
framing: line
lineEnding: crLf
body:
type: text
text: PING
FieldValuesDefaultDescription
kindtcp, udp
socket.framingraw, line, lengthPrefixedrawMessage framing (TCP).
socket.lengthBytes1, 2, 42Prefix size for lengthPrefixed.
socket.lineEndingnone, lf, crLfnoneAdded to text messages.
socket.broadcasttrue, falsefalseUDP: allow broadcast addresses.
body.textThe composer text.