Files
bbs/internal/xfer
Claude f57f4d32ff File transfers on the text BBS: XMODEM, YMODEM, ZMODEM, Kermit
internal/xfer has the protocols, both ways:

- XMODEM: CRC or checksum as the receiver asks, 128 or 1K blocks
- YMODEM batch: names and sizes in block 0, sizes kept exactly
- ZMODEM: hex and binary headers, CRC-16/32, ZDLE escaping; sent in
  32 KB segments ended by ZCRCW, so a ZRPOS costs at most a segment
  and nothing is read while streaming; refused files are skipped
- Kermit: short packets, control quoting, 8th-bit prefixing and repeat
  counts as agreed, block checks 1, 2 and 3

Each has timeouts and retry limits, and takes no more than the upload
behind it allows.  Tests run them against lrzsz (sx/rx, sb/rb, sz/rz)
and C-Kermit (over a raw socket), both ways, and ZMODEM over a line
that damages bytes.

In the file areas: D downloads a file, U uploads into an area (names a
terminal program sends lose their paths and odd characters; XMODEM
asks for one), then asks for descriptions.  The transfer uses the
terminal's buffered reader, so nothing typed ahead is lost, and the
line is let settle afterwards.  Telnet in binary mode now keeps a NUL
after a CR (it is data there); a telnet client that refused binary
mode is warned that X/Y/ZMODEM will likely fail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-10 18:02:13 +00:00
..