XMODEM PROTOCOL BASICS

6. January 1989, 17:34 | by WD Milner | Full Article |

XMODEM is a method for exchanging files over a communications link between two computers. It is based on a program called MODEM written in 1977 by Ward Christensen for the CP/M-80 operating system. It was subsequently modified by Keith Petersen and became known as XMODEM. While many people use the XMODEM protocol on a daily basis, few are familiar with how it actually works. What follows is a basic discussion of the mechanics of XMODEM.

XMODEM tranfers data in 132 byte long blocks of which 128 bytes are data. The format of an XMODEM block is as follows:

Byte		Content
Position	Description
--------	--------------------------------
   1		Start of Header (ASCII 01)
   2		Block Number (0-255)
   3		One's complement of Block Number
 4 - 131	Data
  132  		Checksum

When XMODEM starts, the sender waits for a NAK character from the receiving node. Once an NAK is received, data begins to be transmitted one byte at a time. If more than 10 seconds elapse between blocks, or if longer than 1 second between bytes in a block, the receiving node sends back an NAK. On receipt of an NAK, the sending node retransmits the block. If the block is received correctly (i.e. the receiver calculated checksum matches the one included in the block, and the sequence number is correct) the node sends an ACK character to the sender to indicate that the current block was received intact and the next block should be transmitted. Once the sending node reaches the end of the transmission it repeatedly sends an EOT character until it recieves an ACK in response. This signals the end of the transfer. The number values of the control signals can be found below:

Control		Name and
Character	Hexadecimal Value
--------	--------------------------------
 ACK		Acknowledge, 0x06
 NAK		Negative Acknowledge, 0x15
 SOH		Start of Header, 0x01
 EOT		End of Transmission, 0x04
 CAN		Cancel, 0x18
 STX		Start of Text, 0x02

It was soon realized that the checksum method was inadequate for detecting errors due to the possibility of having errors that actually added up and matched the checksum, thus being undetectable and resulting in file corruption. This was replaced in later versions with a Cyclic Redundancy Check algorithm based on polynomial expansion. It places a two byte number at the end of the block instead of the single byte checksum and is almost 100% error free. To enable transmission with CRC, the receiving node sends the character “C” instead of NAK. If after several unsuccessful connection attempts an NAK charcater is sent in case the sending node is not capable of CRC transmission.

There have been two common extensions developed for XMODEM. The first, called YMODEM, uses a 1024 byte data segment, automatically includes the CRC option, allows a file transfer to be cancelled by sending to consecutive CAN characters and allows more than one file to be sent at a time (YMODEM-Batch) by including a filename in block 0 (sent first instead of block 1). YMODEM transfers are indicated by starting the block with an STX character.

The second extension is called, perhaps not surprisingly, ZMODEM. It functions much as YMODEM except that it only requires the receiving node to send any kind of response when an error occurs. A sender can therefore transmit continuously until receiving an NAK indicating an error in the last block. Transmission must then resume starting at the block in which the error was detected. As a result, high throughput is obtained though persistant errors can have an extremely decgrading effect.

- 30 -

Categories: ,
Keywords: xmodem,ymodem,zmodem,protocols,modem,data,ommunications

Comments


 



Textile help
 
* Indicates a required field.

As a SPAM prevention measure, comments are moderated and will be posted once vetted.

 

Article & Comments


Comments are not enabled for all articles or documents.

Article Navigation
|

Categories

Business
Communications
Electronics
Entertainment
Environment
Government
Internet and WWW
Miscellany
Music and Audio
News
Photography
Privacy
Psychology
Security
Society and Culture
Stage and Screen
Technology
Theology
Tips and Tricks
Web Design
Web Site


The Birches - Milner.ca Support Child Safety Online

 

 
 
 Help to FIGHT spam!
 • 
  •
•••