Overview

Kermit is the survivor protocol — designed for links that lose, mangle, or 7-bit-strip bytes, and the one to reach for when XMODEM/ZMODEM won't go through.

Kermit (Frank da Cruz & Bill Catchings, Columbia University, 1981) moves files as small, fully printable packets with an aggressively negotiated feature set. Everything that could trip up a hostile transport is quoted into the printable ASCII range, so a Kermit transfer survives 7-bit gateways, XON/XOFF flow control, and terminal servers that eat control characters — conditions that defeat the XMODEM family and ZMODEM. The gateway implements a spec-complete Kermit (following da Cruz & Catchings, Kermit, A File Transfer Protocol, 1987) plus the modern long-packet, sliding-window, and streaming extensions used by C-Kermit, in src/kermit.rs.

The gateway is both a Kermit client (push/pull from the File Transfer menu) and a Kermit server (idle, answering a peer's GET / SEND / directory commands). This page walks the transfer mechanics — how a session negotiates and how data moves, for uploads and downloads.

Looking for server mode, the G-subcommand table, the full capability list, or every configuration key? Those live on the comprehensive Kermit Protocol Reference. This page is the focused transfer walkthrough, matching the XMODEM, YMODEM, and ZMODEM references.

Packet Anatomy

Every byte on the wire belongs to a packet, and every packet is printable.

MARK  LEN  SEQ  TYPE  DATA ...  CHECK
 01    ' '..  0-63  S/F/A/D/Z/B/Y/N/...   1-3 bytes
FieldBytesMeaning
MARK1Start-of-packet sentinel, normally 0x01 (Ctrl-A).
LEN1Length of the rest of the packet, tochar-encoded (value + 0x20). A LEN of zero signals a long packet whose real length follows in two extended bytes.
SEQ1Sequence number 0–63 (mod 64), tochar-encoded. Drives ACK matching and sliding windows.
TYPE1A single letter naming the packet (table below).
DATA0–nThe payload, with control / 8-bit / repeated bytes quoted into printable form.
CHECK1–3Block check: 1 byte (6-bit sum), 2 bytes (12-bit sum), or 3 bytes (CRC-16) per the negotiated CHKT.

The packet types used in a transfer:

TypeNameMeaning
SSend-InitOpens a session; its data field is the parameter list.
FFile headerAnnounces the next file's name.
AAttributesOptional: size, modification time, mode, type.
DDataA chunk of file data.
ZEOFEnd of the current file.
BEOT (Break)End of the whole batch — no more files.
YACKPacket accepted (carries negotiated params when acking an S).
NNAKPacket missing or bad — resend it.
EErrorFatal error; the data field is a human-readable reason.

(R get-request, G generic and C host commands, and I init drive server mode — see the full reference.)


The Send-Init Handshake

Before any data, the two ends trade an S packet and agree on a working feature set.

A Kermit session opens with a Send-Init (S) packet whose data field is a string of tochar-encoded parameters. The other end answers with a Y (ACK) packet carrying its parameters, and each side then adopts the safe common subset — the smaller packet length, the lower window size, the intersection of the capability bits. The key fields:

FieldMeaningGateway default
MAXLMaximum packet length (classic, ≤ 94)extended via long packets
TIMETimeout the peer should use
QCTLControl-character quote prefix#
QBIN8th-bit quote prefix (for 7-bit links)& (when asked)
CHKTBlock-check type (1 / 2 / 3)3 (CRC-16)
REPTRepeat-count compression prefix~
CAPASCapability bitmask (long / sliding / attributes)all advertised
WINDOSliding-window size4
MAXLX1/2Extended (long) max packet lengthup to 4096
Block-check types (CHKT)
CHKTCheckNotes
16-bit checksum (1 byte)The universal baseline; weakest.
212-bit checksum (2 bytes)Middle ground for slow microcontrollers.
3CRC-16/KERMIT (3 bytes)Reflected CCITT, poly 0x8408. The default.
Quoting — how Kermit stays printable
  • QCTL (#): a control byte is sent as # followed by the byte with bit 6 flipped, so it prints.
  • QBIN (&): on a 7-bit link, a high-bit byte is sent as & plus its low 7 bits — this is what makes Kermit 8-bit-clean over a 7-bit path.
  • REPT (~): a run of identical bytes is collapsed to ~, a count, and the byte — cheap compression for padding and sparse files.

Upload — Gateway as Receiver

You send a file to the gateway with Kermit. The remote end initiates; the gateway answers and consumes the file.

term     -> S  (Send-Init: peer's params)
gateway  <- Y  (ACK: gateway's params -> common subset)
term     -> F  (filename)          gateway -> Y
term     -> A  (size, mtime, mode) gateway -> Y  (optional)
term     -> D  (data) x N          gateway -> Y each (or windowed)
term     -> Z  (EOF)               gateway -> Y
term     -> B  (EOT, no more files)gateway -> Y

Step by step

  1. Start the receive: press U on the File Transfer menu, enter a name, and choose K — or use the gateway's Kermit server mode and have the peer SEND to it.
  2. The peer sends an S (Send-Init) with its parameters. The gateway replies with a Y (ACK) carrying its own params; both sides settle on the common subset (block-check type, packet length, window size, capabilities).
  3. The peer sends an F packet with the filename; the gateway validates the path (no traversal) and ACKs.
  4. If the peer supports attributes it sends an A packet (size, modification time, mode); the gateway records it and ACKs.
  5. The peer streams D (data) packets. The gateway un-quotes each (# / & / ~), verifies the block check, and ACKs — or, with sliding windows, acknowledges several outstanding packets at once and asks for selective retransmit of any that are missing or bad. A corrupt or timed-out packet is NAK'd to re-prompt the sender; after kermit_max_retries consecutive failures the gateway sends an E (Error) packet and aborts.
  6. The peer sends Z (EOF); the gateway closes the file, applying mtime / mode from the A packet when present.
  7. The peer sends B (EOT) to end the batch; the gateway ACKs and the session ends. (More FZ groups before the B mean more files.)

Download — Gateway as Sender

You pull a file from the gateway with Kermit. The gateway initiates the Send-Init and pushes the file.

gateway  -> S  (Send-Init: gateway's params)
term     <- Y  (ACK: peer's params -> common subset)
gateway  -> F  (filename)          term -> Y
gateway  -> A  (size, mtime, mode) term -> Y  (if attributes negotiated)
gateway  -> D  (data) x N          term -> Y each (or windowed/streamed)
gateway  -> Z  (EOF)               term -> Y
gateway  -> B  (EOT)               term -> Y

Step by step

  1. Press D, pick the file, and choose K. (From server mode, the peer issues a GET and the gateway sends in response — same data flow.)
  2. The gateway sends an S (Send-Init) advertising its parameters and capabilities. The receiver ACKs with its own; the gateway adopts the common subset.
  3. The gateway sends an F packet with the filename, then — if attributes were negotiated — an A packet with the size, mtime, and mode.
  4. The gateway sends D (data) packets, quoting bytes as the negotiated QCTL / QBIN / REPT require. On a reliable link with streaming negotiated it does not pause for per-packet ACKs; otherwise it waits for each Y (or keeps a sliding window of them in flight).
  5. A missing or bad packet is requested again by sequence number (selective retransmit); the gateway resends up to kermit_max_retries times. If it still can't get a packet through, it sends an E (Error) packet so your terminal stops cleanly instead of waiting out its own timeout.
  6. The gateway sends Z (EOF), then B (EOT) once the last file is done. The receiver ACKs and the session ends.

Negotiated Capabilities

What the gateway advertises in its Send-Init — each used only if the peer also offers it.

CapabilityEffect
Long packetsPackets up to kermit_max_packet_length (default 4096, max 9024) instead of the classic 94-byte cap — far less per-packet overhead.
Sliding windowsUp to kermit_window_size (default 4; max 31) packets in flight at once, with selective retransmit — hides round-trip latency.
StreamingOn a reliable link (TCP / SSH) the sender skips per-packet ACKs entirely — a big speed win.
Attribute packetsCarry file size, mtime, mode, type, and ~10 other typed fields so metadata survives the transfer.
Repeat compressionRuns of identical bytes collapse to the ~ prefix + count.
Locking shiftsSO/SI region quoting for 8-bit transit on 7-bit links (off by default; per-byte & prefixing covers the same need).
RESEND (resume)Resume a partial upload via attribute disposition (off by default; see the full reference).
Negotiation is an intersection. The gateway never forces a capability on a peer that didn't ask for it — the working feature set is always the AND of both ends, so a humble vintage Kermit and a modern C-Kermit each get a clean transfer at their own level.

Tunables

The core transfer keys. The full kermit_* family (18 keys, including the quoting and server-mode settings) is documented on the full reference.

KeyDefaultMeaning
kermit_negotiation_timeout300 sTime to complete the Send-Init handshake.
kermit_packet_timeout10 sPer-packet read deadline after Send-Init.
kermit_max_retries5NAK / timeout retransmits per packet.
kermit_max_packet_length4096Advertised long-packet length (10–9024).
kermit_window_size4Sliding-window depth (1–31; 1 = stop-and-wait).
kermit_block_check_type31 = 6-bit, 2 = 12-bit, 3 = CRC-16/KERMIT.
See also: the comprehensive Kermit Protocol Reference (server mode, the full G-subcommand table, every config key, C-Kermit interop, spec citations), the XMODEM / YMODEM / ZMODEM references, and the File Transfer section of the User Manual.

References

Deep-dive reference pages for every protocol and interface, plus the character-set tables and ANSI escape-sequence reference.

XMODEM

128-byte blocks; CRC-16 / checksum negotiation.

YMODEM

Block-0 metadata, batch, exact size truncation.

ZMODEM

Streaming; ZDLE, CRC-32, autostart, resume.

Kermit (this page)

Send-Init negotiation; F / A / D / Z / B transfer.

Punter

C1 dual checksum, two-phase, GOO/BAD/ACK.

AT Commands

Hayes command set, S-registers, +++ escape.

Telnet

IAC negotiation, every option, the NVT data phase.

SSH

Server, gateway, host keys, TOFU, auth modes.

Character Code Tables

Hex tables for every encoding: ASCII, ANSI, PETSCII, ATASCII, Baudot/ITA2, ZX Spectrum, TRS-80.

ANSI Escape Sequences

Cursor, colour/SGR, erase, and screen-mode escape codes, with the raw hex bytes.