B.3. Xmodem, Ymodem and Zmodem

Xmodem sends 128 bytes and a checksum, waits for a Acknowledgment to say all is well and sends the next block. If a negative acknowledgement is received or if no ACK or NAK ever appears then the block is sent again.

Xmodem is a simple protocol, as you would expect of a program written for 8-bit computers runing CP/M. It has lots of inefficiencies and minor problems, such as rounding up the file size to the next 128 byte boundary. These deficiencies lead to an evolution of the protocol with revisions of Xmodem, then Ymodem and finishing with Zmodem. Zmodem is substantially faster than Xmodem and has no niggling problems. The Zmodem protocol is substantially more complex than the Xmodem protocol, but since we only seek to at most compile the code, that complexity need not concern us.

remote bash$ rz
... waiting to receive.**B0100000023be50
Alt-S Upload zmodem
[zmodem upload - Press CTRL-C to quit]
Sending: upload.bin
Bytes Sent:   3072/  10000   BPS:2185     ETA 00:09

If an upload fails and you are left with rz waiting to recieve a file then typing Ctrl-X a number of times will return you to the command prompt. This also works for Xmodem's rx and Ymodem's ry.

A useful Zmodem capability is the ability to resume failed uploads and to send multiple files in a single upload session.

An implementation of Xmodem, Ymodem and Zmodem for POSIX computers is available from http://www.ohse.de/uwe/software/lrzsz.html. Red Hat Linux distribute this in the lrzsz RPM package. lrzsz is a enhanced free software branch of the public domain version of rzsz from Omen Technology.