home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR10 / WXYZMODM.ZIP / ZMODEM.DOC < prev   
Text File  |  1990-10-02  |  100KB  |  3,289 lines

  1.  
  2.  
  3.  
  4.        The ZMODEM Inter Application    File Transfer Protocol
  5.  
  6.                   Chuck Forsberg
  7.  
  8.                Omen    Technology Inc
  9.  
  10.  
  11.       A overview of    this document is available as ZMODEM.OV
  12.                  (in ZMDMOV.ARC)
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.                Omen Technology Incorporated
  30.               The High Reliability Software
  31.  
  32.            17505-V Northwest Sauvie Island Road
  33.               Portland Oregon 97231
  34.             VOICE: 503-621-3406 :VOICE
  35.         Modem: 503-621-3746 Speed 1200,2400,19200
  36.              Compuserve:70007,2304  GEnie:CAF
  37.             UUCP: ...!tektronix!reed!omen!caf
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62. Chapter    0        Rev 8-3-87  Typeset 8-4-87             1
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. Chapter    0             ZMODEM Protocol                 2
  71.  
  72.  
  73.  
  74. 1.  INTENDED AUDIENCE
  75.  
  76. This document is intended for telecommunications managers, systems
  77. programmers, and others    who choose and implement asynchronous file
  78. transfer protocols over    dial-up    networks and related environments.
  79.  
  80.  
  81. 2.  WHY    DEVELOP    ZMODEM?
  82.  
  83. Since its development half a decade ago, the Ward Christensen MODEM
  84. protocol has enabled a wide variety of computer    systems    to interchange
  85. data.  There is    hardly a communications    program    that doesn't at    least
  86. claim to support this protocol,    now called XMODEM.
  87.  
  88. Advances in computing, modems and networking have spread the XMODEM
  89. protocol far beyond the    micro to micro environment for which it    was
  90. designed.  These application have exposed some weaknesses:
  91.  
  92.    + The awkward user interface    is suitable for    computer hobbyists.
  93.      Multiple commands must be keyboarded to transfer each file.
  94.  
  95.    + Since commands must be given to both programs, simple menu    selections
  96.      are not possible.
  97.  
  98.    + The short block length causes throughput to suffer    when used with
  99.      timesharing systems, packet switched networks, satellite circuits,
  100.      and buffered (error correcting) modems.
  101.  
  102.    + The 8 bit checksum    and unprotected    supervison allow undetected errors
  103.      and disrupted file    transfers.
  104.  
  105.    + Only one file can be sent per command.  The file name has to be given
  106.      twice, first to the sending program and then again    to the receiving
  107.      program.
  108.  
  109.    + The transmitted file accumulates as many as 127 bytes of garbage.
  110.  
  111.    + The modification date and other file attributes are lost.
  112.  
  113.    + XMODEM requires complete 8    bit transparency, all 256 codes.  XMODEM
  114.      will not operate over some    networks that use ASCII    flow control or
  115.      escape codes.  Setting network transparency disables important
  116.      control functions for the duration    of the call.
  117.  
  118. A number of other protocols have been developed    over the years,    but none
  119. have proven satisfactory.
  120.  
  121.    + Lack of public domain documentation and example programs have kept
  122.      proprietary protocols such    as Relay, Blast, and others tightly bound
  123.      to    the fortunes of    their suppliers.  These    protocols have not
  124.      benefited from public scrutiny of their design features.
  125.  
  126.  
  127.  
  128. Chapter    2        Rev 8-3-87  Typeset 8-4-87             2
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. Chapter    2             ZMODEM Protocol                 3
  137.  
  138.  
  139.  
  140.    + Link level    protocols such as X.25,    X.PC, and MNP do not manage
  141.      application to application    file transfers.
  142.  
  143.    + Link Level    protocols do not eliminate end-to-end errors.  Interfaces
  144.      between error-free    networks are not necessarily error-free.
  145.      Sometimes,    error-free networks aren't.
  146.  
  147.    + The Kermit    protocol was developed to allow    file transfers in
  148.      environments hostile to XMODEM.  The performance compromises
  149.      necessary to accommodate traditional mainframe environments limit
  150.      Kermit's efficiency.  Even    with completely    transparent channels,
  151.      Kermit control character quoting limits the efficiency of binary file
  152.      transfers to about    75 per cent.[1]
  153.  
  154.      A number of submodes are used in various Kermit programs, including
  155.      different methods of transferring binary files.  Two Kermit programs
  156.      will mysteriously fail to operate with each other if the user has not
  157.      correctly specified these submodes.
  158.  
  159.      Kermit Sliding Windows ("SuperKermit") improves throughput    over
  160.      networks at the cost of increased complexity.  SuperKermit    requires
  161.      full duplex communications    and the    ability    to check for the presence
  162.      of    characters in the input    queue, precluding its implementation on
  163.      some operating systems.
  164.  
  165.      SuperKermit state transitions are encoded in a special language
  166.      "wart" which requires a C compiler.
  167.  
  168.      SuperKermit sends an ACK packet for each data packet of 96    bytes
  169.      (fewer if control characters are present).     This reduces throughput
  170.      on    high speed modems, from    1350 to    177 characters per second in one
  171.      test.
  172.  
  173. A number of extensions to the XMODEM protocol have been    made to    improve
  174. performance and    (in some cases)    the user interface.  They provide useful
  175. improvements in    some applications but not in others.  XMODEM's unprotected
  176. control    messages compromise their reliability.    Complex    proprietary
  177. techniques such    as Cybernetic Data Recovery(TM)[2] improve reliability,
  178. but are    not universally    available.  Some of the    XMODEM mutant protocols
  179. have significant design    flaws of their own.
  180.  
  181.  + XMODEM-k uses 1024 byte blocks to reduce the    overhead from transmission
  182.    delays by 87    per cent compared to XMODEM, but network delays    still
  183.  
  184.  
  185. __________
  186.  
  187.  1. Some Kermit    programs support run length encoding.
  188.  
  189.  2. Unique to DSZ, ZCOMM, Professional-YAM and PowerCom
  190.  
  191.  
  192.  
  193.  
  194. Chapter    2        Rev 8-3-87  Typeset 8-4-87             3
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. Chapter    2             ZMODEM Protocol                 4
  203.  
  204.  
  205.  
  206.    degrade performance.     Some networks cannot transmit 1024 byte packets
  207.    without flow    control, which is difficult to apply without impairing the
  208.    perfect transparency    required by XMODEM.  XMODEM-k adds garbage to
  209.    received files.
  210.  
  211.  + YMODEM sends    the file name, file length, and    creation date at the
  212.    beginning of    each file, and allows optional 1024 byte blocks    for
  213.    improved throughput.     The handling of files that are    not a multiple of
  214.    1024    or 128 bytes is    awkward, especially if the file    length is not
  215.    known in advance, or    changes    during transmission.  The large    number of
  216.    non conforming and substandard programs claiming to support YMODEM
  217.    further complicates its use.
  218.  
  219.  + YMODEM-g provides efficient batch file transfers, preserving    exact file
  220.    length and file modification    date.  YMODEM-g    is a modification to
  221.    YMODEM wherein ACKs for data    blocks are not used.  YMODEM-g is
  222.    essentially insensitive to network delays.  Because it does not support
  223.    error recovery, YMODEM-g must be used hard wired or with a reliable
  224.    link    level protocol.     Successful application    at high    speed requires
  225.    cafeful attention to    transparent flow control.  When    YMODEM-g detects a
  226.    CRC error, data transfers are aborted.  YMODEM-g is easy to implement
  227.    because it closely resembles    standard YMODEM.
  228.  
  229.  + WXMODEM, SEAlink, and MEGAlink have applied a subset    of ZMODEM's
  230.    techniques to "Classic XMODEM" to improve upon their    suppliers'
  231.    previous offerings.    They provide good performance under ideal
  232.    conditions.
  233.  
  234. Another    XMODEM "extension" is protocol cheating, such as Omen Technology's
  235. OverThruster(TM) and OverThruster II(TM).  These improve XMODEM    throughput
  236. under some conditions by compromising error recovery.
  237.  
  238. The ZMODEM Protocol corrects the weaknesses described above while
  239. maintaining as much of XMODEM/CRC's simplicity and prior art as    possible.
  240.  
  241.  
  242.  
  243. 3.  ZMODEM Protocol Design Criteria
  244.  
  245. The design of a    file transfer protocol is an engineering compromise
  246. between    conflicting requirements:
  247.  
  248. 3.1  Ease of Use
  249.  
  250.  + ZMODEM allows either    program    to initiate file transfers, passing
  251.    commands and/or modifiers to    the other program.
  252.  
  253.  + File    names need be entered only once.
  254.  
  255.  + Menu    selections are supported.
  256.  
  257.  
  258.  
  259.  
  260. Chapter    3        Rev 8-3-87  Typeset 8-4-87             4
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. Chapter    3             ZMODEM Protocol                 5
  269.  
  270.  
  271.  
  272.  + Wild    Card names may be used with batch transfers.
  273.  
  274.  + Minimum keystrokes required to initiate transfers.
  275.  
  276.  + ZRQINIT frame sent by sending program can trigger automatic downloads.
  277.  
  278.  + ZMODEM can step down    to YMODEM if the other end does    not support
  279.    ZMODEM.[1]
  280.  
  281. 3.2  Throughput
  282.  
  283. All file transfer protocols make tradeoffs between throughput,
  284. reliability, universality, and complexity according to the technology and
  285. knowledge base available to their designers.
  286.  
  287. In the design of ZMODEM, three applications deserve special attention.
  288.  
  289.   + Network applications with significant delays (relative to character
  290.     transmission time) and low error rate
  291.  
  292.   + Timesharing    and buffered modem applications    with significant delays
  293.     and    throughput that    is quickly degraded by reverse channel traffic.
  294.     ZMODEM's economy of    reverse    channel    bandwidth allows modems    that
  295.     dynamically    partition bandwidth between the    two directions to operate
  296.     at optimal speeds.    Special    ZMODEM features    allow simple, efficient
  297.     implementation on a    wide variety of    timesharing hosts.
  298.  
  299.   + Direct modem to modem communications with high error rate
  300.  
  301. Unlike Sliding Windows Kermit, ZMODEM is not optimized for optimum
  302. throughput when    error rate and delays are both high.  This tradeoff
  303. markedly reduces code complexity and memory requirements.  ZMODEM
  304. generally provides faster error    recovery than network compatible XMODEM
  305. implementations.
  306.  
  307. In the absence of network delays, rapid    error recovery is possible, much
  308. faster than MEGAlink and network compatible versions of    YMODEM and XMODEM.
  309.  
  310. File transfers begin immediately regardless of which program is    started
  311. first, without the 10 second delay associated with XMODEM.
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319. __________
  320.  
  321.  1. Provided the transmission medium accommodates X/YMODEM.
  322.  
  323.  
  324.  
  325.  
  326. Chapter    3        Rev 8-3-87  Typeset 8-4-87             5
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. Chapter    3             ZMODEM Protocol                 6
  335.  
  336.  
  337.  
  338. 3.3  Integrity and Robustness
  339.  
  340. Once a ZMODEM session is begun,    all transactions are protected with 16 or
  341. 32 bit CRC.[2] Complex proprietary techniques such as Cybernetic Data
  342. Recovery(TM)[3]    are not    needed for reliable transfers.
  343.  
  344. An optional 32-bit CRC used as the frame check sequence    in ADCCP (ANSI
  345. X3.66, also known as FIPS PUB 71 and FED-STD-1003, the U.S. versions of
  346. CCITT's    X.25) is used when available.  The 32 bit CRC reduces undetected
  347. errors by at least five    orders of magnitude when properly applied (-1
  348. preset,    inversion).
  349.  
  350. A security challenge mechanism guards against "Trojan Horse" messages
  351. written    to mimic legitimate command or file downloads.
  352.  
  353. 3.4  Ease of Implementation
  354.  
  355. ZMODEM accommodates a wide variety of systems:
  356.  
  357.  + Microcomputers that cannot overlap disk and serial i/o
  358.  
  359.  + Microcomputers that cannot overlap serial send and receive
  360.  
  361.  + Computers and/or networks requiring XON/XOFF    flow control
  362.  
  363.  + Computers that cannot check the serial input    queue for the presence of
  364.    data    without    having to wait for the data to arrive.
  365.  
  366. Although ZMODEM    provides "hooks" for multiple "threads", ZMODEM    is not
  367. intended to replace link level protocols such as X.25.
  368.  
  369. ZMODEM accommodates network and    timesharing system delays by continuously
  370. transmitting data unless the receiver interrupts the sender to request
  371. retransmission of garbled data.     ZMODEM    in effect uses the entire file as
  372. a window.[4] Using the entire file as a    window simplifies buffer
  373. management, avoiding the window    overrun    failure    modes that affect
  374. MEGAlink, SuperKermit, and others.
  375.  
  376. ZMODEM provides    a general purpose application to application file transfer
  377. protocol which may be used directly or with with reliable link level
  378.  
  379.  
  380. __________
  381.  
  382.  2. Except for the CAN-CAN-CAN-CAN-CAN abort sequence which requires five
  383.     successive CAN characters.
  384.  
  385.  3. Unique to Professional-YAM and PowerCom
  386.  
  387.  4. Streaming strategies are discussed in coming chapters.
  388.  
  389.  
  390.  
  391.  
  392. Chapter    3        Rev 8-3-87  Typeset 8-4-87             6
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400. Chapter    3             ZMODEM Protocol                 7
  401.  
  402.  
  403.  
  404. protocols such as X.25,    MNP, Fastlink, etc.  When used with X.25, MNP,
  405. Fastlink, etc.,    ZMODEM detects and corrects errors in the interfaces
  406. between    error controlled media and the remainder of the    communications
  407. link.
  408.  
  409. ZMODEM was developed for the public domain under a Telenet contract.  The
  410. ZMODEM protocol    descriptions and the Unix rz/sz    program    source code are
  411. public domain.    No licensing, trademark, or copyright restrictions apply
  412. to the use of the protocol, the    Unix rz/sz source code and the ZMODEM
  413. name.
  414.  
  415.  
  416. 4.  EVOLUTION OF ZMODEM
  417.  
  418. In early 1986, Telenet funded a    project    to develop an improved public
  419. domain application to application file transfer    protocol.  This    protocol
  420. would alleviate    the throughput problems    network    customers were
  421. experiencing with XMODEM and Kermit file transfers.
  422.  
  423. In the beginning, we thought a few modifications to XMODEM would allow
  424. high performance over packet switched networks while preserving    XMODEM's
  425. simplicity.
  426.  
  427. The initial concept would add a    block number to    the ACK    and NAK    characters
  428. used by    XMODEM.     The resultant protocol    would allow the    sender to send
  429. more than one block before waiting for a response.
  430.  
  431. But how    to add the block number    to XMODEM's ACK    and NAK?  WXMODEM,
  432. SEAlink, MEGAlink and some other protocols add binary byte(s) to indicate
  433. the block number.
  434.  
  435. Pure binary was    unsuitable for ZMODEM because binary code combinations
  436. won't pass bidirectionally through some    modems,    networks and operating
  437. systems.  Other    operating systems may not be able to recognize something
  438. coming back[1] unless a    break signal or    a system dependent code    or
  439. sequence is present.  By the time all this and other problems with the
  440. simple ACK/NAK sequences mentioned above were corrected, XMODEM's simple
  441. ACK and    NACK characters    had evolved into a real    packet.     The Frog was
  442. riveting.
  443.  
  444. Managing the window[2] was another problem.  Experience    gained in
  445. debugging The Source's SuperKermit protocol indicated a    window size of
  446. about 1000 characters was needed at 1200 bps.  High speed modems require a
  447.  
  448.  
  449. __________
  450.  
  451.  1. Without stopping for a response
  452.  
  453.  2. The    WINDOW is the data in transit between sender and receiver.
  454.  
  455.  
  456.  
  457.  
  458. Chapter    4        Rev 8-3-87  Typeset 8-4-87             7
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466. Chapter    4             ZMODEM Protocol                 8
  467.  
  468.  
  469.  
  470. window of 20000    or more    characters for full throughput.     Much of the
  471. SuperKermit's inefficiency, complexity and debugging time centered around
  472. its ring buffering and window management.  There had to    be a better way    to
  473. get the    job done.
  474.  
  475. A sore point with XMODEM and its progeny is error recovery.  More to the
  476. point, how can the receiver determine whether the sender has responded,    or
  477. is ready to respond, to    a retransmission request?  XMODEM attacks the
  478. problem    by throwing away characters until a certain period of silence.
  479. Too short a time allows    a spurious pause in output (network or timesharing
  480. congestion) to masquerade as error recovery.  Too long a timeout
  481. devastates throughput, and allows a noisy line to lock up the protocol.
  482. SuperKermit solves the problem with a distinct start of    packet character
  483. (SOH).    WXMODEM    and ZMODEM use unique character    sequences to delineate the
  484. start of frames.  SEAlink and MEGAlink do not address this problem.
  485.  
  486. A further error    recovery problem arises    in streaming protocols.     How does
  487. the receiver know when (or if) the sender has recognized its error signal?
  488. Is the next packet the correct response    to the error signal?  Is it
  489. something left over "in    the queue"?  Or    is this    new subpacket one of many
  490. that will have to be discarded because the sender did not receive the
  491. error signal?  How long    should this continue before sending another error
  492. signal?     How can the protocol prevent this from    degenerating into an
  493. argument about mixed signals?
  494.  
  495. SuperKermit uses selective retransmission, so it can accept any    good
  496. packet it receives.  Each time the SuperKermit receiver    gets a data
  497. packet,    it must    decide which outstanding packet    (if any) it "wants most"
  498. to receive, and    asks for that one.  In practice, complex software "hacks"
  499. are needed to attain acceptable    robustness.[3]
  500.  
  501. For ZMODEM, we decided to forgo    the complexity of SuperKermit's    packet
  502. assembly scheme    and its    associated buffer management logic and memory
  503. requirements.
  504.  
  505. Another    sore point with    XMODEM and WXMODEM is the garbage added    to files.
  506. This was acceptable with old CP/M files    which had no exact length, but not
  507. with modern systems such as DOS    and Unix.  YMODEM uses file length
  508. information transmitted    in the header block to trim the    output file, but
  509. this causes data loss when transferring    files that grow    during a transfer.
  510. In some    cases, the file    length may be unknown, as when data is obtained
  511. from a process.     Variable length data subpackets solve both of these
  512.  
  513.  
  514. __________
  515.  
  516.  3. For    example, when SuperKermit encounters certain errors, the wndesr
  517.     function is    called to determine the    next block to request.    A burst    of
  518.     errors generates several wasteful requests to retransmit the same
  519.     block.
  520.  
  521.  
  522.  
  523.  
  524. Chapter    4        Rev 8-3-87  Typeset 8-4-87             8
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532. Chapter    4             ZMODEM Protocol                 9
  533.  
  534.  
  535.  
  536. problems.
  537.  
  538. Since some characters had to be    escaped    anyway,    there wasn't any point
  539. wasting    bytes to fill out a fixed packet length    or to specify a    variable
  540. packet length.    In ZMODEM, the length of data subpackets is denoted by
  541. ending each subpacket with an escape sequence similar to BISYNC    and HDLC.
  542.  
  543. The end    result is a ZMOEM header containing a "frame type", four bytes of
  544. supervisory information, and its own CRC.  Data    frames consist of a header
  545. followed by 1 or more data subpackets.    In the absence of transmission
  546. errors,    an entire file can be sent in one data frame.
  547.  
  548. Since the sending system may be    sensitive to numerous control characters
  549. or strip parity    in the reverse data path, all of the headers sent by the
  550. receiver are sent in hex.  A common lower level    routine    receives all
  551. headers, allowing the main program logic to deal with headers and data
  552. subpackets as objects.
  553.  
  554. With equivalent    binary (efficient) and hex (application    friendly) frames,
  555. the sending program can    send an    "invitation to receive"    sequence to
  556. activate the receiver without crashing the remote application with
  557. unexpected control characters.
  558.  
  559. Going "back to scratch"    in the protocol    design presents    an opportunity to
  560. steal good ideas from many sources and to add a    few new    ones.
  561.  
  562. From Kermit and    UUCP comes the concept of an initial dialog to exchange
  563. system parameters.
  564.  
  565. ZMODEM generalizes Compuserve B    Protocol's host    controlled transfers to
  566. single command AutoDownload and    command    downloading.  A    Security Challenge
  567. discourages password hackers and Trojan    Horse authors from abusing
  568. ZMODEM's power.
  569.  
  570. We were    also keen to the pain and $uffering of legions of
  571. telecommunicators whose    file transfers have been ruined    by communications
  572. and timesharing    faults.     ZMODEM's file transfer    recovery and advanced file
  573. management are dedicated to these kindred comrades.
  574.  
  575. After ZMODEM had been operational a short time,    Earl Hall pointed out the
  576. obvious: ZMODEM's user friendly    AutoDownload was almost    useless    if the
  577. user must assign transfer options to each of the sending and receiving
  578. programs.  Now,    transfer options may be    specified to/by    the sending
  579. program, which passes them to the receiving program in the ZFILE header.
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590. Chapter    5        Rev 8-3-87  Typeset 8-4-87             9
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598. Chapter    5             ZMODEM Protocol                10
  599.  
  600.  
  601.  
  602. 5.  ROSETTA STONE
  603.  
  604. Here are some definitions which    reflect    current    vernacular in the computer
  605. media.    The attempt here is identify the file transfer protocol    rather
  606. than specific programs.
  607.  
  608. FRAME    A ZMODEM frame consists    of a header and    0 or more data subpackets.
  609.  
  610. XMODEM    refers to the original 1977 file transfer etiquette introduced by
  611.     Ward Christensen's MODEM2 program.  It's also called the MODEM or
  612.     MODEM2 protocol.  Some who are unaware of MODEM7's unusual batch
  613.     file mode call it MODEM7.  Other aliases include "CP/M Users's
  614.     Group" and "TERM II FTP    3".  This protocol is supported    by most
  615.     communications programs    because    it is easy to implement.
  616.  
  617. XMODEM/CRC replaces XMODEM's 1 byte checksum with a two    byte Cyclical
  618.     Redundancy Check (CRC-16), improving error detection.
  619.  
  620. XMODEM-1k Refers to XMODEM-CRC with optional 1024 byte blocks.
  621.  
  622. YMODEM    refers to the XMODEM/CRC protocol with batch transmission and
  623.     optional 1024 byte blocks as described in YMODEM.DOC.[1]
  624.  
  625.  
  626. 6.  ZMODEM REQUIREMENTS
  627.  
  628. ZMODEM requires    an 8 bit transfer medium.[1] ZMODEM escapes network
  629. control    characters to allow operation with packet switched networks.  In
  630. general, ZMODEM    operates over any path that supports XMODEM, and over many
  631. that don't.
  632.  
  633. To support full    streaming,[2] the transmission path should either assert
  634. flow control or    pass full speed    transmission without loss of data.
  635. Otherwise the ZMODEM sender must manage    the window size.
  636.  
  637. 6.1  File Contents
  638.  
  639. 6.1.1  Binary Files
  640. ZMODEM places no constraints on    the information    content    of binary files,
  641. except that the    number of bits in the file must    be a multiple of 8.
  642.  
  643.  
  644.  
  645. __________
  646.  
  647.  1. Available on TeleGodzilla as part of YZMODEM.ZOO
  648.  
  649.  1. The    ZMODEM design allows encoded packets for less transparent media.
  650.  
  651.  2. With XOFF and XON, or out of band flow control such    as X.25    or CTS
  652.  
  653.  
  654.  
  655.  
  656. Chapter    6        Rev 8-3-87  Typeset 8-4-87            10
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664. Chapter    6             ZMODEM Protocol                11
  665.  
  666.  
  667.  
  668. 6.1.2  Text Files
  669. Since ZMODEM is    used to    transfer files between different types of computer
  670. systems, text files must meet minimum requirements if they are to be
  671. readable on a wide variety of systems and environments.
  672.  
  673. Text lines consist of printing ASCII characters, spaces, tabs, and
  674. backspaces.
  675.  
  676. 6.1.2.1     ASCII End of Line
  677. The ASCII code definition allows text lines terminated by a CR/LF (015,
  678. 012) sequence, or by a NL (012)    character.  Lines logically terminated by
  679. a lone CR (013)    are not    ASCII text.
  680.  
  681. A CR (013) without a linefeed implies overprinting, and    is not acceptable
  682. as a logical line separator.  Overprinted lines    should print all important
  683. characters in the last pass to allow CRT displays to display meaningful
  684. text.  Overstruck characters may be generated by backspacing or    by
  685. overprinting the line with CR (015) not    followed by LF.
  686.  
  687. Overstruck characters generated    with backspaces    should be sent with the
  688. most important character last to accommodate CRT displays that cannot
  689. overstrike.  The sending program may use the ZCNL bit to force the
  690. receiving program to convert the received end of line to its local end of
  691. line convention.[3]
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714. __________
  715.  
  716.  3. Files that have been translated in such a way as to    modify their
  717.     length cannot be updated with the ZCRECOV Conversion Option.
  718.  
  719.  
  720.  
  721.  
  722. Chapter    6        Rev 8-3-87  Typeset 8-4-87            11
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730. Chapter    6             ZMODEM Protocol                12
  731.  
  732.  
  733.  
  734. 7.  ZMODEM BASICS
  735.  
  736. 7.1  Packetization
  737.  
  738. ZMODEM frames differ somewhat from XMODEM blocks.  XMODEM blocks are not
  739. used for the following reasons:
  740.  
  741.  + Block numbers are limited to    256
  742.  
  743.  + No provision    for variable length blocks
  744.  
  745.  + Line    hits corrupt protocol signals, causing failed file transfers.  In
  746.    particular, modem errors sometimes generate false block numbers, false
  747.    EOTs    and false ACKs.     False ACKs are    the most troublesome as    they cause
  748.    the sender to lose synchronization with the receiver.
  749.  
  750.    State of the    art programs such as Professional-YAM and ZCOMM    overcome
  751.    some    of these weaknesses with clever    proprietary code, but a    stronger
  752.    protocol is desired.
  753.  
  754.  + It is difficult to determine    the beginning and ends of XMODEM blocks
  755.    when    line hits cause    a loss of synchronization.  This precludes rapid
  756.    error recovery.
  757.  
  758. 7.2  Link Escape Encoding
  759.  
  760. ZMODEM achieves    data transparency by extending the 8 bit character set
  761. (256 codes) with escape    sequences based    on the ZMODEM data link    escape
  762. character ZDLE.[1]
  763.  
  764. Link Escape coding permits variable length data    subpackets without the
  765. overhead of a separate byte count.  It allows the beginning of frames to
  766. be detected without special timing techniques, facilitating rapid error
  767. recovery.
  768.  
  769. Link Escape coding does    add some overhead.  The    worst case, a file
  770. consisting entirely of escaped characters, would incur a 50% overhead.
  771.  
  772. The ZDLE character is special.    ZDLE represents    a control sequence of some
  773. sort.  If a ZDLE character appears in binary data, it is prefixed with
  774. ZDLE, then sent    as ZDLEE.
  775.  
  776. The value for ZDLE is octal 030    (ASCII CAN).  This particular value was
  777. chosen to allow    a string of 5 consecutive CAN characters to abort a ZMODEM
  778.  
  779.  
  780. __________
  781.  
  782.  1. This and other constants are defined in the    zmodem.h include file.
  783.     Please note    that constants with a leading 0    are octal constants in C.
  784.  
  785.  
  786.  
  787.  
  788. Chapter    7        Rev 8-3-87  Typeset 8-4-87            12
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796. Chapter    7             ZMODEM Protocol                13
  797.  
  798.  
  799.  
  800. session, compatible with YMODEM    session    abort.
  801.  
  802. Since CAN is not used in normal    terminal operations, interactive
  803. applications and communications    programs can monitor the data flow for
  804. ZDLE.  The following characters    can be scanned to detect the ZRQINIT
  805. header,    the invitation to automatically    download commands or files.
  806.  
  807. Receipt    of five    successive CAN characters will abort a ZMODEM session.
  808. Eight CAN characters are sent.
  809.  
  810. The receiving program decodes any sequence of ZDLE followed by a byte with
  811. bit 6 set and bit 5 reset (upper case letter, either parity) to    the
  812. equivalent control character by    inverting bit 6.  This allows the
  813. transmitter to escape any control character that cannot    be sent    by the
  814. communications medium.    In addition, the receiver recognizes escapes for
  815. 0177 and 0377 should these characters need to be escaped.
  816.  
  817. ZMODEM software    escapes    ZDLE, 020, 0220, 021, 0221, 023, and 0223.  If
  818. preceded by 0100 or 0300 (@), 015 and 0215 are also escaped to protect the
  819. Telenet    command    escape CR-@-CR.     The receiver ignores 021, 0221, 023, and
  820. 0223 characters    in the data stream.
  821.  
  822. The ZMODEM routines in zm.c accept an option to    escape all control
  823. characters, to allow operation with less transparent networks.    This
  824. option can be given to either the sending or receiving program.
  825.  
  826. 7.3  Header
  827.  
  828. All ZMODEM frames begin    with a header which may    be sent    in binary or HEX
  829. form.  ZMODEM uses a single routine to recognize binary    and hex    headers.
  830. Either form of the header contains the same raw    information:
  831.  
  832.  + A type byte[2] [3]
  833.  
  834.  + Four    bytes of data indicating flags and/or numeric quantities depending
  835.    on the frame    type
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843. __________
  844.  
  845.  2. The    frame types are    cardinal numbers beginning with    0 to minimize
  846.     state transition table memory requirements.
  847.  
  848.  3. Future extensions to ZMODEM    may use    the high order bits of the type
  849.     byte to indicate thread selection.
  850.  
  851.  
  852.  
  853.  
  854. Chapter    7        Rev 8-3-87  Typeset 8-4-87            13
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862. Chapter    7             ZMODEM Protocol                14
  863.  
  864.  
  865.  
  866.            Figure 1.  Order of Bytes in    Header
  867.  
  868.            TYPE:  frame    type
  869.            F0: Flags least significant byte
  870.            P0: file Position least significant
  871.            P3: file Position most significant
  872.  
  873.                TYPE     F3 F2 F1 F0
  874.                -------------------
  875.                TYPE     P0 P1 P2 P3
  876.  
  877. 7.3.1  16 Bit CRC Binary Header
  878. A binary header    is sent    by the sending program to the receiving    program.
  879. ZDLE encoding accommodates XON/XOFF flow control.
  880.  
  881. A binary header    begins with the    sequence ZPAD, ZDLE, ZBIN.
  882.  
  883. The frame type byte is ZDLE encoded.
  884.  
  885. The four position/flags    bytes are ZDLE encoded.
  886.  
  887. A two byte CRC of the frame type and position/flag bytes is ZDLE encoded.
  888.  
  889. 0 or more binary data subpackets with 16 bit CRC will follow depending on
  890. the frame type.
  891.  
  892. The function zsbhdr transmits a    binary header.    The function zgethdr
  893. receives a binary or hex header.
  894.  
  895.            Figure 2.  16 Bit CRC Binary    Header
  896.         * ZDLE A TYPE F3/P0    F2/P1 F1/P2 F0/P3 CRC-1    CRC-2
  897.  
  898.  
  899. 7.3.2  32 Bit CRC Binary Header
  900. A "32 bit CRC" Binary header is    similar    to a Binary Header, except the
  901. ZBIN (A) character is replaced by a ZBIN32 (C) character, and four
  902. characters of CRC are sent.  0 or more binary data subpackets with 32 bit
  903. CRC will follow    depending on the frame type.
  904.  
  905. The common variable Txfcs32 may    be set TRUE for    32 bit CRC iff the
  906. receiver indicates the capability with the CANFC32 bit.     The zgethdr,
  907. zsdata and zrdata functions automatically adjust to the    type of    Frame
  908. Check Sequence being used.
  909.            Figure 3.  32 Bit CRC Binary    Header
  910.       *    ZDLE C TYPE F3/P0 F2/P1    F1/P2 F0/P3 CRC-1 CRC-2    CRC-3 CRC-4
  911.  
  912.  
  913. 7.3.3  HEX Header
  914. The receiver sends responses in    hex headers.  The sender also uses hex
  915. headers    when they are not followed by binary data subpackets.
  916.  
  917.  
  918.  
  919.  
  920. Chapter    7        Rev 8-3-87  Typeset 8-4-87            14
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928. Chapter    7             ZMODEM Protocol                15
  929.  
  930.  
  931.  
  932. Hex encoding protects the reverse channel from random control characters.
  933. The hex    header receiving routine ignores parity.
  934.  
  935. Use of Kermit style encoding for control and paritied characters was
  936. considered and rejected    because    of increased possibility of interacting
  937. with some timesharing systems' line edit functions.  Use of HEX    headers
  938. from the receiving program allows control characters to    be used    to
  939. interrupt the sender when errors are detected.    A HEX header may be used
  940. in place of a binary header wherever convenient.  If a data packet follows
  941. a HEX header, it is protected with CRC-16.
  942.  
  943. A hex header begins with the sequence ZPAD, ZPAD, ZDLE,    ZHEX.  The zgethdr
  944. routine    synchronizes with the ZPAD-ZDLE    sequence.  The extra ZPAD
  945. character allows the sending program to    detect an asynchronous header
  946. (indicating an error condition)    and then call zgethdr to receive the
  947. header.
  948.  
  949. The type byte, the four    position/flag bytes, and the 16    bit CRC    thereof
  950. are sent in hex    using the character set    01234567890abcdef.  Upper case hex
  951. digits are not allowed;    they false trigger XMODEM and YMODEM programs.
  952. Since this form    of hex encoding    detects    many patterns of errors,
  953. especially missing characters, a hex header with 32 bit    CRC has    not been
  954. defined.
  955.  
  956. A carriage return and line feed    are sent with HEX headers.  The    receive
  957. routine    expects    to see at least    one of these characters, two if    the first
  958. is CR.    The CR/LF aids debugging from printouts, and helps overcome
  959. certain    operating system related problems.
  960.  
  961. An XON character is appended to    all HEX    packets    except ZACK and    ZFIN.  The
  962. XON releases the sender    from spurious XOFF flow    control    characters
  963. generated by line noise, a common occurrence.  XON is not sent after ZACK
  964. headers    to protect flow    control    in streaming situations.  XON is not sent
  965. after a    ZFIN header to allow clean session cleanup.
  966.  
  967. 0 or more data subpackets will follow depending    on the frame type.
  968.  
  969. The function zshhdr sends a hex    header.
  970.  
  971.               Figure 4.  HEX Header
  972.  
  973.       *    * ZDLE B TYPE F3/P0 F2/P1 F1/P2    F0/P3 CRC-1 CRC-2 CR LF    XON
  974.  
  975. (TYPE, F3...F0,    CRC-1, and CRC-2 are each sent as two hex digits.)
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986. Chapter    7        Rev 8-3-87  Typeset 8-4-87            15
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994. Chapter    7             ZMODEM Protocol                16
  995.  
  996.  
  997.  
  998. 7.4  Binary Data Subpackets
  999.  
  1000. Binary data subpackets immediately follow the associated binary    header
  1001. packet.     A binary data packet contains 0 to 1024 bytes of data.
  1002. Recommended length values are 256 bytes    below 2400 bps,    512 at 2400 bps,
  1003. and 1024 above 4800 bps    or when    the data link is known to be relatively
  1004. error free.[4]
  1005.  
  1006. No padding is used with    binary data subpackets.     The data bytes    are ZDLE
  1007. encoded    and transmitted.  A ZDLE and frameend are then sent, followed by
  1008. two or four ZDLE encoded CRC bytes.  The CRC accumulates the data bytes
  1009. and frameend.
  1010.  
  1011. The function zsdata sends a data subpacket.  The function zrdata receives
  1012. a data subpacket.
  1013.  
  1014. 7.5  ASCII Encoded Data    Subpacket
  1015.  
  1016. The format of ASCII Encoded data subpackets is not currently specified.
  1017. These could be used for    server commands, or main transfers in 7    bit
  1018. environments.
  1019.  
  1020.  
  1021. 8.  PROTOCOL TRANSACTION OVERVIEW
  1022.  
  1023. As with    the XMODEM recommendation, ZMODEM timing is receiver driven.  The
  1024. transmitter should not time out    at all,    except to abort    the program if no
  1025. headers    are received for an extended period of time, say one minute.[1]
  1026.  
  1027.  
  1028. 8.1  Session Startup
  1029.  
  1030. To start a ZMODEM file transfer    session, the sending program is    called
  1031. with the names of the desired file(s) and option(s).
  1032.  
  1033. The sending program may    send the string    "rz\r" to invoke the receiving
  1034. program    from a possible    command    mode.  The "rz"    followed by carriage
  1035. return activates a ZMODEM receive program or command if    it were    not
  1036. already    active.
  1037.  
  1038. The sender may then display a message intended for human consumption, such
  1039.  
  1040.  
  1041. __________
  1042.  
  1043.  4. Strategies for adjusting the subpacket length for optimal results
  1044.     based on real time error rates are still evolving.    Shorter    subpackets
  1045.     speed error    detection but increase protocol    overhead slightly.
  1046.  
  1047.  1. Special considerations apply when sending commands.
  1048.  
  1049.  
  1050.  
  1051.  
  1052. Chapter    8        Rev 8-3-87  Typeset 8-4-87            16
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060. Chapter    8             ZMODEM Protocol                17
  1061.  
  1062.  
  1063.  
  1064. as a list of the files requested, etc.
  1065.  
  1066. Then the sender    may send a ZRQINIT header.  The    ZRQINIT    header causes a
  1067. previously started receive program to send its ZRINIT header without
  1068. delay.
  1069.  
  1070. In an interactive or conversational mode, the receiving    application may
  1071. monitor    the data stream    for ZDLE.  The following characters may    be scanned
  1072. for B00    indicating a ZRQINIT header, a command to download a command or
  1073. data.
  1074.  
  1075. The sending program awaits a command from the receiving    program    to start
  1076. file transfers.     If a "C", "G",    or NAK is received, an XMODEM or YMODEM
  1077. file transfer is indicated, and    file transfer(s) use the YMODEM    protocol.
  1078. Note: With ZMODEM and YMODEM, the sending program provides the file name,
  1079. but not    with XMODEM.
  1080.  
  1081. In case    of garbled data, the sending program can repeat    the invitation to
  1082. receive    a number of times until    a session starts.
  1083.  
  1084. When the ZMODEM    receive    program    starts,    it immediately sends a ZRINIT
  1085. header to initiate ZMODEM file transfers, or a ZCHALLENGE header to verify
  1086. the sending program.  The receive program resends its header at    response
  1087. time (default 10 second) intervals for a suitable period of time (40
  1088. seconds    total) before falling back to YMODEM protocol.
  1089.  
  1090. If the receiving program receives a ZRQINIT header, it resends the ZRINIT
  1091. header.     If the    sending    program    receives the ZCHALLENGE    header,    it places
  1092. the data in ZP0...ZP3 in an answering ZACK header.
  1093.  
  1094. If the receiving program receives a ZRINIT header, it is an echo
  1095. indicating that    the sending program is not operational.
  1096.  
  1097. Eventually the sending program correctly receives the ZRINIT header.
  1098.  
  1099. The sender may then send an optional ZSINIT frame to define the    receiving
  1100. program's Attn sequence, or to specify complete    control    character
  1101. escaping.[2]
  1102.  
  1103. If the ZSINIT header specifies ESCCTL or ESC8, a HEX header is used, and
  1104. the receiver activates the specified ESC modes before reading the
  1105. following data subpacket.
  1106.  
  1107. The receiver sends a ZACK header in response, optionally containing the
  1108.  
  1109.  
  1110. __________
  1111.  
  1112.  2. If the receiver specifies the same or higher level of escaping, the
  1113.     ZSINIT frame need not be sent unless an Attn sequence is needed.
  1114.  
  1115.  
  1116.  
  1117.  
  1118. Chapter    8        Rev 8-3-87  Typeset 8-4-87            17
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126. Chapter    8             ZMODEM Protocol                18
  1127.  
  1128.  
  1129.  
  1130. serial number of the receiving program,    or 0.
  1131.  
  1132. 8.2  File Transmission
  1133.  
  1134. The sender then    sends a    ZFILE header with ZMODEM Conversion, Management,
  1135. and Transport options[3] followed by a ZCRCW data subpacket containing the
  1136. file name, file    length,    modification date, and other information identical
  1137. to that    used by    YMODEM Batch.
  1138.  
  1139. The receiver examines the file name, length, and date information provided
  1140. by the sender in the context of    the specified transfer options,    the
  1141. current    state of its file system(s), and local security    requirements.  The
  1142. receiving program should insure    the pathname and options are compatible
  1143. with its operating environment and local security requirements.
  1144.  
  1145. The receiver may respond with a    ZSKIP header, which makes the sender
  1146. proceed    to the next file (if any) in the batch.
  1147.  
  1148.        If the receiver has a file with the same    name and length,
  1149.        it may respond with a ZCRC header, which    requires the
  1150.        sender to perform a 32 bit CRC on the file and transmit the
  1151.        complement of the CRC in    a ZCRC header.[4] The receiver
  1152.        uses this information to    determine whether to accept the
  1153.        file or skip it.     This sequence is triggered by the ZMCRC
  1154.        Management Option.
  1155.  
  1156. A ZRPOS    header from the    receiver initiates transmission    of the file data
  1157. starting at the    offset in the file specified in    the ZRPOS header.
  1158. Normally the receiver specifies    the data transfer to begin begin at
  1159. offset 0 in the    file.
  1160.        The receiver may    start the transfer further down    in the
  1161.        file.  This allows a file transfer interrupted by a loss
  1162.        or carrier or system crash to be    completed on the next
  1163.        connection without requiring the    entire file to be
  1164.        retransmitted.[5] If downloading    a file from a timesharing
  1165.        system that becomes sluggish, the transfer can be
  1166.        interrupted and resumed later with no loss of data.
  1167.  
  1168. The sender sends a ZDATA binary    header (with file position) followed by
  1169. one or more data subpackets.
  1170.  
  1171.  
  1172.  
  1173. __________
  1174.  
  1175.  3. See    below, under ZFILE header type.
  1176.  
  1177.  4. The    crc is initialized to 0xFFFFFFFF.
  1178.  
  1179.  5. This does not apply    to files that have been    translated.
  1180.  
  1181.  
  1182.  
  1183.  
  1184. Chapter    8        Rev 8-3-87  Typeset 8-4-87            18
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192. Chapter    8             ZMODEM Protocol                19
  1193.  
  1194.  
  1195.  
  1196. The receiver compares the file position    in the ZDATA header with the
  1197. number of characters successfully received to the file.     If they do not
  1198. agree, a ZRPOS error response is generated to force the    sender to the
  1199. right position within the file.[6]
  1200.  
  1201. A data subpacket terminated by ZCRCG and CRC does not elicit a response
  1202. unless an error    is detected; more data subpacket(s) follow immediately.
  1203.  
  1204.        ZCRCQ data subpackets expect a ZACK response with the
  1205.        receiver's file offset if no error, otherwise a ZRPOS
  1206.        response    with the last good file    offset.     Another data
  1207.        subpacket continues immediately.     ZCRCQ subpackets are
  1208.        not used    if the receiver    does not indicate FDX ability
  1209.        with the    CANFDX bit.
  1210.  
  1211. ZCRCW data subpackets expect a response    before the next    frame is sent.
  1212. If the receiver    does not indicate overlapped I/O capability with the
  1213. CANOVIO    bit, or    sets a buffer size, the    sender uses the    ZCRCW to allow
  1214. the receiver to    write its buffer before    sending    more data.
  1215.  
  1216.        A zero length data frame    may be used as an idle
  1217.        subpacket to prevent the    receiver from timing out in
  1218.        case data is not    immediately available to the sender.
  1219.  
  1220. In the absence of fatal    error, the sender eventually encounters    end of
  1221. file.  If the end of file is encountered within    a frame, the frame is
  1222. closed with a ZCRCE data subpacket which does not elicit a response
  1223. except in case of error.
  1224.  
  1225. The sender sends a ZEOF    header with the    file ending offset equal to
  1226. the number of characters in the    file.  The receiver compares this
  1227. number with the    number of characters received.    If the receiver    has
  1228. received all of    the file, it closes the    file.  If the file close was
  1229. satisfactory, the receiver responds with ZRINIT.  If the receiver has
  1230. not received all the bytes of the file,    the receiver ignores the ZEOF
  1231. because    a new ZDATA is coming.    If the receiver    cannot properly    close
  1232. the file, a ZFERR header is sent.
  1233.  
  1234.        After all files are processed, any further protocol
  1235.        errors should not prevent the sending program from
  1236.        returning with a    success    status.
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242. __________
  1243.  
  1244.  6. If the ZMSPARS option is used, the receiver    instead    seeks to the
  1245.     position given in the ZDATA    header.
  1246.  
  1247.  
  1248.  
  1249.  
  1250. Chapter    8        Rev 8-3-87  Typeset 8-4-87            19
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258. Chapter    8             ZMODEM Protocol                20
  1259.  
  1260.  
  1261.  
  1262. 8.3  Session Cleanup
  1263.  
  1264. The sender closes the session with a ZFIN header.  The receiver
  1265. acknowledges this with its own ZFIN header.
  1266.  
  1267. When the sender    receives the acknowledging header, it sends two
  1268. characters, "OO" (Over and Out)    and exits to the operating system or
  1269. application that invoked it.  The receiver waits briefly for the "O"
  1270. characters, then exits whether they were received or not.
  1271.  
  1272. 8.4  Session Abort Sequence
  1273.  
  1274. If the receiver    is receiving data in streaming mode, the Attn
  1275. sequence is executed to    interrupt data transmission before the Cancel
  1276. sequence is sent.  The Cancel sequence consists    of eight CAN
  1277. characters and ten backspace characters.  ZMODEM only requires five
  1278. Cancel characters, the other three are "insurance".
  1279.  
  1280. The trailing backspace characters attempt to erase the effects of the
  1281. CAN characters if they are received by a command interpreter.
  1282.  
  1283.        static char canistr[] = {
  1284.     24,24,24,24,24,24,24,24,8,8,8,8,8,8,8,8,8,8,0
  1285.        };
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.  
  1292.  
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316. Chapter    8        Rev 8-3-87  Typeset 8-4-87            20
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324. Chapter    8             ZMODEM Protocol                21
  1325.  
  1326.  
  1327.  
  1328. 9.  STREAMING TECHNIQUES / ERROR RECOVERY
  1329.  
  1330. It is a    fact of    life that no single method of streaming    is applicable
  1331. to a majority of today's computing and telecommunications
  1332. environments.  ZMODEM provides several data streaming methods
  1333. selected according to the limitations of the sending environment,
  1334. receiving environment, and transmission    channel(s).
  1335.  
  1336.  
  1337. 9.1  Full Streaming with Sampling
  1338.  
  1339. If the receiver    can overlap serial I/O with disk I/O, and if the
  1340. sender can sample the reverse channel for the presence of data
  1341. without    having to wait,    full streaming can be used with    no Attn
  1342. sequence required.  The    sender begins data transmission    with a ZDATA
  1343. header and continuous ZCRCG data subpackets.  When the receiver
  1344. detects    an error, it executes the Attn sequence    and then sends a
  1345. ZRPOS header with the correct position within the file.
  1346.  
  1347. At the end of each transmitted data subpacket, the sender checks for
  1348. the presence of    an error header    from the receiver.  To do this,    the
  1349. sender samples the reverse data    stream for the presence    of either a
  1350. ZPAD or    CAN character.[1] Flow control characters (if present) are
  1351. acted upon.
  1352.  
  1353. Other characters (indicating line noise) increment a counter which is
  1354. reset whenever the sender waits    for a header from the receiver.     If
  1355. the counter overflows, the sender sends    the next data subpacket    as
  1356. ZCRCW, and waits for a response.
  1357.  
  1358. ZPAD indicates some sort of error header from the receiver.  A CAN
  1359. suggests the user is attempting    to "stop the bubble machine" by
  1360. keyboarding CAN    characters.  If    one of these characters    is seen, an
  1361. empty ZCRCE data subpacket is sent.  Normally, the receiver will have
  1362. sent an    ZRPOS or other error header, which will    force the sender to
  1363. resume transmission at a different address, or take other action.  In
  1364. the unlikely event the ZPAD or CAN character was spurious, the
  1365. receiver will time out and send    a ZRPOS    header.[2]
  1366.  
  1367. Then the receiver's response header is read and    acted upon.[3]
  1368.  
  1369.  
  1370. __________
  1371.  
  1372.  1. The    call to    rdchk()    in sz.c    performs this function.
  1373.  
  1374.  2. The    obvious    choice of ZCRCW    packet,    which would trigger an ZACK from
  1375.     the    receiver, is not used because multiple in transit frames could
  1376.     result if the channel has a    long propagation delay.
  1377.  
  1378.  3. The    call to    getinsync() in sz.c performs this function.
  1379.  
  1380.  
  1381.  
  1382. Chapter    9        Rev 8-3-87  Typeset 8-4-87            21
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390. Chapter    9             ZMODEM Protocol                22
  1391.  
  1392.  
  1393.  
  1394. A ZRPOS    header resets the sender's file    offset to the correct
  1395. position.  If possible,    the sender should purge    its output buffers
  1396. and/or networks    of all unprocessed output data,    to minimize the
  1397. amount of unwanted data    the receiver must discard before receiving
  1398. data starting at the correct file offset.  The next transmitted    data
  1399. frame should be    a ZCRCW    frame followed by a wait to guarantee
  1400. complete flushing of the network's memory.
  1401.  
  1402. If the receiver    gets a ZACK header with    an address that    disagrees
  1403. with the sender    address, it is ignored,    and the    sender waits for
  1404. another    header.     A ZFIN, ZABORT, or TIMEOUT terminates the session; a
  1405. ZSKIP terminates the processing    of this    file.
  1406.  
  1407. The reverse channel is then sampled for    the presence of    another
  1408. header from the    receiver.[4] if    one is detected, the getinsync()
  1409. function is again called to read another error header.    Otherwise,
  1410. transmission resumes at    the (possibly reset) file offset with a    ZDATA
  1411. header followed    by data    subpackets.
  1412.  
  1413.  
  1414. 9.1.1  Window Management
  1415. When sending data through a network, some nodes    of the network store
  1416. data while it is transferred to    the receiver.  7000 bytes and more of
  1417. transient storage have been observed.  Such a large amount of storage
  1418. causes the transmitter to "get ahead" of the reciever.    This can be
  1419. fatal with MEGAlink and    other protocols    that depend on timely
  1420. notification of    errors from the    receiver.  This    condition is not
  1421. fatal with ZMODEM, but it does slow error recovery.
  1422.  
  1423. To manage the window size, the sending program uses ZCRCQ data
  1424. subpackets to trigger ZACK headers from    the receiver.  The returning
  1425. ZACK headers inform the    sender of the receiver's progress.  When the
  1426. window size (current transmitter file offset - last reported receiver
  1427. file offset) exceeds a specified value,    the sender waits for a
  1428. ZACK[5]    packet with a receiver file offset that    reduces    the window
  1429. size.
  1430.  
  1431. Unix sz    versions beginning with    May 9 1987 control the window size
  1432. with the "-w N"    option,    where N    is the maximum window size.  Pro-YAM,
  1433. ZCOMM and DSZ versions beginning with May 9 1987 control the window
  1434. size with "zmodem pwN".     This is compatible with previous versions of
  1435. these programs.[6]
  1436.  
  1437.  
  1438. __________
  1439.  
  1440.  4. If sampling    is possible.
  1441.  
  1442.  5. ZRPOS and other error packets are handled normally.
  1443.  
  1444.  6. When used with modems or networks that simultaneously assert flow
  1445.  
  1446.  
  1447.  
  1448. Chapter    9        Rev 8-3-87  Typeset 8-4-87            22
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456. Chapter    9             ZMODEM Protocol                23
  1457.  
  1458.  
  1459.  
  1460. 9.2  Full Streaming with Reverse Interrupt
  1461.  
  1462. The above method cannot    be used    if the reverse data stream cannot be
  1463. sampled    without    entering an I/O    wait.  An alternate method is to
  1464. instruct the receiver to interrupt the sending program when an error
  1465. is detected.
  1466.  
  1467. The receiver can interrupt the sender with a control character,    break
  1468. signal,    or combination thereof,    as specified in    the Attn sequence.
  1469. After executing    the Attn sequence, the receiver    sends a    hex ZRPOS
  1470. header to force    the sender to resend the lost data.
  1471.  
  1472. When the sending program responds to this interrupt, it    reads a    HEX
  1473. header (normally ZRPOS)    from the receiver and takes the    action
  1474. described in the previous section.  The    Unix sz.c program uses a
  1475. setjmp/longjmp call to catch the interrupt generated by    the Attn
  1476. sequence.  Catching the    interrupt activates the    getinsync() function
  1477. to read    the receiver's error header and    take appropriate action.
  1478.  
  1479. When compiled for standard SYSTEM III/V    Unix, sz.c uses    an Attn
  1480. sequence of Ctrl-C followed by a 1 second pause    to interrupt the
  1481. sender,    then give the sender (Unix) time to prepare for    the
  1482. receiver's error header.
  1483.  
  1484.  
  1485. 9.3  Full Streaming with Sliding Window
  1486.  
  1487. If none    of the above methods is    applicable, hope is not    yet lost.  If
  1488. the sender can buffer responses    from the receiver, the sender can use
  1489. ZCRCQ data subpackets to get ACKs from the receiver without
  1490. interrupting the transmission of data.    After a    sufficient number of
  1491. ZCRCQ data subpackets have been    sent, the sender can read one of the
  1492. headers    that should have arrived in its    receive    interrupt buffer.
  1493.  
  1494. A problem with this method is the possibility of wasting an excessive
  1495. amount of time responding to the receiver's error header.  It may be
  1496. possible to program the    receiver's Attn    sequence to flush the
  1497. sender's interrupt buffer before sending the ZRPOS header.
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505. __________________________________________________________________________
  1506.  
  1507.     control with XON and XOFF characters and pass XON characters that
  1508.     violate flow control, the receiving    program    should have a revision
  1509.     date of May    9 or later.
  1510.  
  1511.  
  1512.  
  1513.  
  1514. Chapter    9        Rev 8-3-87  Typeset 8-4-87            23
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522. Chapter    9             ZMODEM Protocol                24
  1523.  
  1524.  
  1525.  
  1526. 9.4  Full Streaming over Error Free Channels
  1527.  
  1528. File transfer protocols    predicated on the existence of an error    free
  1529. end to end communications channel have been proposed from time to
  1530. time.  Such channels have proven to be more readily available in
  1531. theory than in actuality.  The frequency of undetected errors
  1532. increases when modem scramblers    have more bits than the    error
  1533. detecting CRC.
  1534.  
  1535. A ZMODEM sender    assuming an error free channel with end    to end flow
  1536. control    can send the entire file in one    frame without any checking of
  1537. the reverse stream.  If    this channel is    completely transparent,    only
  1538. ZDLE need be escaped.  The resulting protocol overhead for average
  1539. long files is less than    one per    cent.[7]
  1540.  
  1541. 9.5  Segmented Streaming
  1542.  
  1543. If the receiver    cannot overlap serial and disk I/O, it uses the
  1544. ZRINIT frame to    specify    a buffer length    which the sender will not
  1545. overflow.  The sending program sends a ZCRCW data subpacket and    waits
  1546. for a ZACK header before sending the next segment of the file.
  1547.  
  1548. If the sending program supports    reverse    data stream sampling or
  1549. interrupt, error recovery will be faster (on average) than a protocol
  1550. (such as YMODEM) that sends large blocks.
  1551.  
  1552. A sufficiently large receiving buffer allows throughput    to closely
  1553. approach that of full streaming.  For example, 16kb segmented
  1554. streaming adds about 3 per cent    to full    streaming ZMODEM file
  1555. transfer times when the    round trip delay is five seconds.
  1556.  
  1557.  
  1558. 10.  ATTENTION SEQUENCE
  1559.  
  1560. The receiving program sends the    Attn sequence whenever it detects an
  1561. error and needs    to interrupt the sending program.
  1562.  
  1563. The default Attn string    value is empty (no Attn    sequence).  The
  1564. receiving program resets Attn to the empty default before each
  1565. transfer session.
  1566.  
  1567. The sender specifies the Attn sequence in its optional ZSINIT frame.
  1568. The Attn string    is terminated with a null.
  1569.  
  1570.  
  1571.  
  1572. __________
  1573.  
  1574.  7. One    in 256 for escaping ZDLE, about    two (four if 32    bit CRC    is used)
  1575.     in 1024 for    data subpacket CRC's
  1576.  
  1577.  
  1578.  
  1579.  
  1580. Chapter    10        Rev 8-3-87  Typeset 8-4-87            24
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588. Chapter    10             ZMODEM Protocol                25
  1589.  
  1590.  
  1591.  
  1592. Two meta-characters perform special functions:
  1593.  
  1594.    + \335 (octal) Send a break signal
  1595.  
  1596.    + \336 (octal) Pause    one second
  1597.  
  1598.  
  1599. 11.  FRAME TYPES
  1600.  
  1601. The numeric values for the values shown    in boldface are    given in
  1602. zmodem.h.  Unused bits and unused bytes    in the header (ZP0...ZP3) are
  1603. set to 0.
  1604.  
  1605. 11.1  ZRQINIT
  1606.  
  1607. Sent by    the sending program, to    trigger    the receiving program to send
  1608. its ZRINIT header.  This avoids    the aggravating    startup    delay
  1609. associated with    XMODEM and Kermit transfers.  The sending program may
  1610. repeat the receive invitation (including ZRQINIT) if a response    is
  1611. not obtained at    first.
  1612.  
  1613. ZF0 contains ZCOMMAND if the program is    attempting to send a command,
  1614. 0 otherwise.
  1615.  
  1616. 11.2  ZRINIT
  1617.  
  1618. Sent by    the receiving program.    ZF0 and    ZF1 contain the     bitwise or
  1619. of the receiver    capability flags:
  1620. #define    CANCRY        8    /* Receiver can    decrypt    */
  1621. #define    CANFDX       01    /* Rx can send and receive true    FDX */
  1622. #define    CANOVIO       02    /* Rx can receive data during disk I/O */
  1623. #define    CANBRK       04    /* Rx can send a break signal */
  1624. #define    CANCRY      010    /* Receiver can    decrypt    */
  1625. #define    CANLZW      020    /* Receiver can    uncompress */
  1626. #define    CANFC32      040    /* Receiver can    use 32 bit Frame Check */
  1627. #define    ESCCTL     0100    /* Receiver expects ctl    chars to be escaped
  1628. */
  1629. #define    ESC8     0200    /* Receiver expects 8th    bit to be escaped */
  1630.  
  1631. ZP0 and    ZP1 contain the    size of    the receiver's buffer in bytes,    or 0
  1632. if nonstop I/O is allowed.
  1633.  
  1634. 11.3  ZSINIT
  1635.  
  1636. The Sender sends flags followed    by a binary data subpacket terminated
  1637. with ZCRCW.
  1638.  
  1639. /* Bit Masks for ZSINIT    flags byte ZF0 */
  1640. #define    TESCCTL    0100   /* Transmitter expects ctl chars    to be escaped
  1641. */
  1642. #define    TESC8    0200   /* Transmitter expects 8th bit to be escaped
  1643.  
  1644.  
  1645.  
  1646. Chapter    11        Rev 8-3-87  Typeset 8-4-87            25
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654. Chapter    11             ZMODEM Protocol                26
  1655.  
  1656.  
  1657.  
  1658. */
  1659.  
  1660. The data subpacket contains the    null terminated    Attn sequence,
  1661. maximum    length 32 bytes    including the terminating null.
  1662.  
  1663. 11.4  ZACK
  1664.  
  1665. Acknowledgment to a ZSINIT frame, ZCHALLENGE header, ZCRCQ or ZCRCW
  1666. data subpacket.     ZP0 to    ZP3 contain file offset.  The response to
  1667. ZCHALLENGE contains the    same 32    bit number received in the ZCHALLENGE
  1668. header.
  1669.  
  1670. 11.5  ZFILE
  1671.  
  1672. This frame denotes the beginning of a file transmission    attempt.
  1673. ZF0, ZF1, and ZF2 may contain options.    A value    of 0 in    each of    these
  1674. bytes implies no special treatment.  Options specified to the
  1675. receiver override options specified to the sender with the exception
  1676. of ZCBIN which overrides any other Conversion Option given to the
  1677. sender or receiver.
  1678.  
  1679.  
  1680. 11.5.1    ZF0: Conversion    Option
  1681. If the receiver    does not recognize the Conversion Option, an
  1682. application dependent default conversion may apply.
  1683.  
  1684. ZCBIN "Binary" transfer    - inhibit conversion unconditionally
  1685.  
  1686. ZCNL Convert received end of line to local end of line
  1687.      convention.  The supported    end of line conventions    are
  1688.      CR/LF (most ASCII based operating systems except Unix
  1689.      and Macintosh), and NL (Unix).  Either of these two end
  1690.      of    line conventions meet the permissible ASCII
  1691.      definitions for Carriage Return and Line Feed/New Line.
  1692.      Neither the ASCII code nor    ZMODEM ZCNL encompass lines
  1693.      separated only by carriage    returns.  Other    processing
  1694.      appropriate to ASCII text files and the local operating
  1695.      system may    also be    applied    by the receiver.[1]
  1696.  
  1697. ZCRECOV    Recover/Resume interrupted file    transfer.  ZCREVOV is
  1698.      also useful for updating a    remote copy of a file that
  1699.      grows without resending of    old data.  If the destination
  1700.      file exists and is    no longer than the source, append to
  1701.      the destination file and start transfer at    the offset
  1702.      corresponding to the receiver's end of file.  This
  1703.  
  1704.  
  1705. __________
  1706.  
  1707.  1. Filtering RUBOUT, NULL, Ctrl-Z, etc.
  1708.  
  1709.  
  1710.  
  1711.  
  1712. Chapter    11        Rev 8-3-87  Typeset 8-4-87            26
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720. Chapter    11             ZMODEM Protocol                27
  1721.  
  1722.  
  1723.  
  1724.      option does not apply if the source file is shorter.
  1725.      Files that    have been converted (e.g., ZCNL) or subject
  1726.      to    a single ended Transport Option    cannot have their
  1727.      transfers recovered.
  1728.  
  1729. 11.5.2    ZF1: Management    Option
  1730. If the receiver    does not recognize the Management Option, the
  1731. file should be transferred normally.
  1732.  
  1733. The ZMSKNOLOC bit instructs the    receiver to bypass the
  1734. current    file if    the receiver does not have a file with the
  1735. same name.
  1736.  
  1737. Five bits (defined by ZMMASK) define the following set of
  1738. mutually exclusive management options.
  1739.  
  1740. ZMNEWL Transfer    file if    destination file absent.  Otherwise,
  1741.      transfer file overwriting destination if the source file
  1742.      is    newer or longer.
  1743.  
  1744. ZMCRC Compare the source and destination files.     Transfer if
  1745.      file lengths or file polynomials differ.
  1746.  
  1747. ZMAPND Append source file contents to the end of the existing
  1748.      destination file (if any).
  1749.  
  1750. ZMCLOB Replace existing    destination file (if any).
  1751.  
  1752. ZMDIFF Transfer    file if    destination file absent.  Otherwise,
  1753.      transfer file overwriting destination if files have
  1754.      different lengths or dates.
  1755.  
  1756. ZMPROT Protect destination file    by transferring    file only if
  1757.      the destination file is absent.
  1758.  
  1759. ZMNEW Transfer file if destination file    absent.     Otherwise,
  1760.      transfer file overwriting destination if the source file
  1761.      is    newer.
  1762.  
  1763. 11.5.3    ZF2: Transport Option
  1764. If the receiver    does not implement the particular transport
  1765. option,    the file is copied without conversion for later
  1766. processing.
  1767.  
  1768. ZTLZW Lempel-Ziv compression.  Transmitted data    will be
  1769.      identical to that produced    by compress 4.0    operating on
  1770.      a computer    with VAX byte ordering,    using 12 bit
  1771.      encoding.
  1772.  
  1773. ZTCRYPT    Encryption.  An    initial    null terminated    string
  1774.      identifies    the key.  Details to be    determined.
  1775.  
  1776.  
  1777.  
  1778. Chapter    11        Rev 8-3-87  Typeset 8-4-87            27
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786. Chapter    11             ZMODEM Protocol                28
  1787.  
  1788.  
  1789.  
  1790. ZTRLE Run Length encoding, Details to be determined.
  1791.  
  1792. A ZCRCW    data subpacket follows with file name, file length,
  1793. modification date, and other information described in a    later
  1794. chapter.
  1795.  
  1796. 11.5.4    ZF3: Extended Options
  1797. The Extended Options are bit encoded.
  1798.  
  1799. ZTSPARS    Special    processing for sparse files, or    sender managed
  1800.      selective retransmission.    Each file segment is transmitted as
  1801.      a separate    frame, where the frames    are not    necessarily
  1802.      contiguous.  The sender should end    each segment with a ZCRCW
  1803.      data subpacket and    process    the expected ZACK to insure no data
  1804.      is    lost.  ZTSPARS cannot be used with ZCNL.
  1805.  
  1806. 11.6  ZSKIP
  1807.  
  1808. Sent by    the receiver in    response to ZFILE, makes the sender skip to
  1809. the next file.
  1810.  
  1811. 11.7  ZNAK
  1812.  
  1813. Indicates last header was garbled.  (See also ZRPOS).
  1814.  
  1815. 11.8  ZABORT
  1816.  
  1817. Sent by    receiver to terminate batch file transfers when    requested by
  1818. the user.  Sender responds with    a ZFIN sequence.[2]
  1819.  
  1820. 11.9  ZFIN
  1821.  
  1822. Sent by    sending    program    to terminate a ZMODEM session.    Receiver
  1823. responds with its own ZFIN.
  1824.  
  1825. 11.10  ZRPOS
  1826.  
  1827. Sent by    receiver to force file transfer    to resume at file offset
  1828. given in ZP0...ZP3.
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837. __________
  1838.  
  1839.  2. Or ZCOMPL in case of server    mode.
  1840.  
  1841.  
  1842.  
  1843.  
  1844. Chapter    11        Rev 8-3-87  Typeset 8-4-87            28
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852. Chapter    11             ZMODEM Protocol                29
  1853.  
  1854.  
  1855.  
  1856. 11.11  ZDATA
  1857.  
  1858. ZP0...ZP3 contain file offset.    One or more data subpackets follow.
  1859.  
  1860. 11.12  ZEOF
  1861.  
  1862. Sender reports End of File.  ZP0...ZP3 contain the ending file
  1863. offset.
  1864.  
  1865. 11.13  ZFERR
  1866.  
  1867. Error in reading or writing file, protocol equivalent to ZABORT.
  1868.  
  1869. 11.14  ZCRC
  1870.  
  1871. Request    (receiver) and response    (sender) for file polynomial.
  1872. ZP0...ZP3 contain file polynomial.
  1873.  
  1874. 11.15  ZCHALLENGE
  1875.  
  1876. Request    sender to echo a random    number in ZP0...ZP3 in a ZACK frame.
  1877. Sent by    the receiving program to the sending program to    verify that
  1878. it is connected    to an operating    program, and was not activated by
  1879. spurious data or a Trojan Horse    message.
  1880.  
  1881. 11.16  ZCOMPL
  1882.  
  1883. Request    now completed.
  1884.  
  1885. 11.17  ZCAN
  1886.  
  1887. This is    a pseudo frame type returned by    gethdr() in response to    a
  1888. Session    Abort sequence.
  1889.  
  1890. 11.18  ZFREECNT
  1891.  
  1892. Sending    program    requests a ZACK    frame with ZP0...ZP3 containing    the
  1893. number of free bytes on    the current file system.  A value of 0
  1894. represents an indefinite amount    of free    space.
  1895.  
  1896. 11.19  ZCOMMAND
  1897.  
  1898. ZCOMMAND is sent in a binary frame.  ZF0 contains 0 or ZCACK1 (see
  1899. below).
  1900.  
  1901. A ZCRCW    data subpacket follows,    with the ASCII text command string
  1902. terminated with    a NULL character.  If the command is intended to be
  1903. executed by the    operating system hosting the receiving program
  1904. (e.g., "shell escape"),    it must    have "!" as the    first character.
  1905. Otherwise the command is meant to be executed by the application
  1906. program    which receives the command.
  1907.  
  1908.  
  1909.  
  1910. Chapter    11        Rev 8-3-87  Typeset 8-4-87            29
  1911.  
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918. Chapter    11             ZMODEM Protocol                30
  1919.  
  1920.  
  1921.  
  1922. If the receiver    detects    an illegal or badly formed command, the
  1923. receiver immediately responds with a ZCOMPL header with    an error
  1924. code in    ZP0...ZP3.
  1925.  
  1926. If ZF0 contained ZCACK1, the receiver immediately responds with    a
  1927. ZCOMPL header with 0 status.
  1928.  
  1929. Otherwise, the receiver    responds with a    ZCOMPL header when the
  1930. operation is completed.     The exit status of the    completed command is
  1931. stored in ZP0...ZP3.  A    0 exit status implies nominal completion of
  1932. the command.
  1933.  
  1934. If the command causes a    file to    be transmitted,    the command sender
  1935. will see a ZRQINIT frame from the other    computer attempting to send
  1936. data.
  1937.  
  1938. The sender examines ZF0    of the received    ZRQINIT    header to verify it
  1939. is not an echo of its own ZRQINIT header.  It is illegal for the
  1940. sending    program    to command the receiving program to send a command.
  1941.  
  1942. If the receiver    program    does not implement command downloading,    it
  1943. may display the    command    to the standard    error output, then return a
  1944. ZCOMPL header.
  1945.  
  1946.  
  1947.  
  1948. 12.  SESSION TRANSACTION EXAMPLES
  1949.  
  1950. 12.1  A    simple file transfer
  1951.  
  1952. A simple transaction, one file,    no errors, no CHALLENGE, overlapped
  1953. I/O:
  1954.  
  1955. Sender           Receiver
  1956.  
  1957. "rz\r"
  1958. ZRQINIT(0)
  1959.            ZRINIT
  1960. ZFILE
  1961.            ZRPOS
  1962. ZDATA data ...
  1963. ZEOF
  1964.            ZRINIT
  1965. ZFIN
  1966.            ZFIN
  1967. OO
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976. Chapter    12        Rev 8-3-87  Typeset 8-4-87            30
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984. Chapter    12             ZMODEM Protocol                31
  1985.  
  1986.  
  1987.  
  1988. 12.2  Challenge    and Command Download
  1989.  
  1990.  
  1991. Sender            Receiver
  1992.  
  1993. "rz\r"
  1994. ZRQINIT(ZCOMMAND)
  1995.             ZCHALLENGE(random-number)
  1996. ZACK(same-number)
  1997.             ZRINIT
  1998. ZCOMMAND, ZDATA
  1999.             (Performs Command)
  2000.             ZCOMPL
  2001. ZFIN
  2002.             ZFIN
  2003. OO
  2004.  
  2005.  
  2006. 13.  ZFILE FRAME FILE INFORMATION
  2007.  
  2008. ZMODEM sends the same file information with the    ZFILE frame data
  2009. that YMODEM Batch sends    in its block 0.
  2010.  
  2011. N.B.: The pathname (file name) field is    mandatory.
  2012.  
  2013. Pathname The pathname (conventionally, the file    name) is sent as a
  2014.      null terminated ASCII string.  This is the    filename format    used
  2015.      by    the handle oriented MSDOS(TM) functions    and C library fopen
  2016.      functions.     An assembly language example follows:
  2017.                DB      'foo.bar',0
  2018.      No    spaces are included in the pathname.  Normally only the    file
  2019.      name stem (no directory prefix) is    transmitted unless the
  2020.      sender has    selected YAM's f option    to send    the full absolute or
  2021.      relative pathname.     The source drive designator (A:, B:, etc.)
  2022.      usually is    not sent.
  2023.  
  2024.              Filename Considerations
  2025.  
  2026.     + File names should be translated to lower case    unless the
  2027.       sending system supports upper/lower case file    names.    This
  2028.       is a convenience for users of    systems    (such as Unix) which
  2029.       store    filenames in upper and lower case.
  2030.  
  2031.     + The receiver should accommodate file names in    lower and
  2032.       upper    case.
  2033.  
  2034.     + When transmitting files between different operating
  2035.       systems, file    names must be acceptable to both the sender
  2036.       and receiving    operating systems.  If not, transformations
  2037.       should be applied to make the    file names acceptable.    If
  2038.       the transformations are unsuccessful,    a new file name    may
  2039.  
  2040.  
  2041.  
  2042. Chapter    13        Rev 8-3-87  Typeset 8-4-87            31
  2043.  
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050. Chapter    13             ZMODEM Protocol                32
  2051.  
  2052.  
  2053.  
  2054.       be invented be the receiving program.
  2055.  
  2056.      If    directories are    included, they are delimited by    /; i.e.,
  2057.      "subdir/foo" is acceptable, "subdir\foo" is not.
  2058.  
  2059. Length The file    length and each    of the succeeding fields are
  2060.      optional.[1] The length field is stored as    a decimal string
  2061.      counting the number of data bytes in the file.
  2062.  
  2063.      The ZMODEM    receiver uses the file length as an estimate only.
  2064.      It    may be used to display an estimate of the transmission time,
  2065.      and may be    compared with the amount of free disk space.  The
  2066.      actual length of the received file    is determined by the data
  2067.      transfer.    A file may grow    after transmission commences, and
  2068.      all the data will be sent.
  2069.  
  2070. Modification Date A single space separates the modification date
  2071.      from the file length.
  2072.  
  2073.      The mod date is optional, and the filename    and length may be
  2074.      sent without requiring the    mod date to be sent.
  2075.  
  2076.      The mod date is sent as an    octal number giving the    time the
  2077.      contents of the file were last changed measured in    seconds    from
  2078.      Jan 1 1970    Universal Coordinated Time (GMT).  A date of 0
  2079.      implies the modification date is unknown and should be left as
  2080.      the date the file is received.
  2081.  
  2082.      This standard format was chosen to    eliminate ambiguities
  2083.      arising from transfers between different time zones.
  2084.  
  2085.  
  2086. File Mode A single space separates the file mode from the
  2087.      modification date.     The file mode is stored as an octal string.
  2088.      Unless the    file originated    from a Unix system, the    file mode is
  2089.      set to 0.    rz(1) checks the file mode for the 0x8000 bit which
  2090.      indicates a Unix type regular file.  Files    with the 0x8000    bit
  2091.      set are assumed to    have been sent from another Unix (or
  2092.      similar) system which uses    the same file conventions.  Such
  2093.      files are not translated in any way.
  2094.  
  2095.  
  2096. Serial Number A    single space separates the serial number from the
  2097.      file mode.     The serial number of the transmitting program is
  2098.      stored as an octal    string.     Programs which    do not have a serial
  2099.  
  2100.  
  2101. __________
  2102.  
  2103.  1. Fields may not be skipped.
  2104.  
  2105.  
  2106.  
  2107.  
  2108. Chapter    13        Rev 8-3-87  Typeset 8-4-87            32
  2109.  
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116. Chapter    13             ZMODEM Protocol                33
  2117.  
  2118.  
  2119.  
  2120.      number should omit    this field, or set it to 0.  The receiver's
  2121.      use of this field is optional.
  2122.  
  2123. The file information is    terminated by a    null.  If only the pathname
  2124. is sent, the pathname is terminated with two nulls.  The length    of
  2125. the file information subpacket,    including the trailing null, must
  2126. not exceed 1024    bytes; a typical length    is less    than 64    bytes.
  2127.  
  2128.  
  2129. 14.  PERFORMANCE RESULTS
  2130.  
  2131. 14.1  Compatibility
  2132.  
  2133. Extensive testing has demonstrated ZMODEM to be    compatible with
  2134. satellite links, packet    switched networks, microcomputers,
  2135. minicomputers, regular and error correcting buffered modems at 75 to
  2136. 19200 bps.  ZMODEM's economy of    reverse    channel    bandwidth allows
  2137. modems that dynamically    partition bandwidth between the    two
  2138. directions to operate at optimal speeds.
  2139.  
  2140. 14.2  Throughput
  2141.  
  2142. Between    two single task    PC-XT computers    sending    a program image    on
  2143. an in house Telenet link, SuperKermit provided 72 ch/sec throughput
  2144. at 1200    baud.  YMODEM-k    yielded    85 chars/sec, and ZMODEM provided
  2145. 113 chars/sec.    XMODEM was not measured, but would have    been much
  2146. slower based on    observed network propagation delays.
  2147.  
  2148. Recent tests downloading large binary files to an IBM PC (4.7 mHz
  2149. V20) running YAMK 16.30    with table driven 32 bit CRC calculation
  2150. yielded    a throughput of    1870 cps on a 19200 bps    direct connection.
  2151.  
  2152. Tests with TELEBIT TrailBlazer modems have shown transfer rates
  2153. approaching 1400 characters per    second for long    files.    When files
  2154. are compressed,    effective transfer rates of 2000 characters per
  2155. second are possible.
  2156.  
  2157.  
  2158. 14.3  Error Recovery
  2159.  
  2160. Some tests of ZMODEM protocol error recovery performance have been
  2161. made.  A PC-AT with SCO    SYS V Xenix or DOS 3.1 was connected to    a PC
  2162. with DOS 2.1 either directly at    9600 bps or with unbuffered dial-up
  2163. 1200 bps modems.  The ZMODEM software was configured to    use 1024
  2164. byte data subpacket lengths above 2400 bps, 256    otherwise.
  2165.  
  2166. Because    no time    delays are necessary in    normal file transfers, per
  2167. file negotiations are much faster than with YMODEM, the    only
  2168. observed delay being the time required by the program(s) to update
  2169. logging    files.
  2170.  
  2171.  
  2172.  
  2173.  
  2174. Chapter    14        Rev 8-3-87  Typeset 8-4-87            33
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182. Chapter    14             ZMODEM Protocol                34
  2183.  
  2184.  
  2185.  
  2186. During a file transfer,    a short    line hit seen by the receiver
  2187. usually    induces    a CRC error.  The interrupt sequence is    usually    seen
  2188. by the sender before the next data subpacket is    completely sent, and
  2189. the resultant loss of data throughput averages about half a data
  2190. subpacket per line hit.     At 1200 bps this is would be about .75
  2191. second lost per    hit.  At 10-5 error rate, this would degrade
  2192. throughput by about 9 per cent.
  2193.  
  2194. The throughput degradation increases with increasing channel delay,
  2195. as more    data subpackets    in transit through the channel are discarded
  2196. when an    error is detected.
  2197.  
  2198. A longer noise burst that affects both the receiver and    the sender's
  2199. reception of the interrupt sequence usually causes the sender to
  2200. remain silent until the    receiver times out in 10 seconds.  If the
  2201. round trip channel delay exceeds the receiver's    10 second timeout,
  2202. recovery from this type    of error may become difficult.
  2203.  
  2204. Noise affecting    only the sender    is usually ignored, with one common
  2205. exception.  Spurious XOFF characters generated by noise    stop the
  2206. sender until the receiver times    out and    sends an interrupt sequence
  2207. which concludes    with an    XON.
  2208.  
  2209. In summation, ZMODEM performance in the    presence of errors resembles
  2210. that of    X.PC and SuperKermit.  Short bursts cause minimal data
  2211. retransmission.     Long bursts (such as pulse dialing noises) often
  2212. require    a timeout error    to restore the flow of data.
  2213.  
  2214.  
  2215. 15.  PACKET SWITCHED NETWORK CONSIDERATIONS
  2216.  
  2217. Flow control is    necessary for printing messages    and directories, and
  2218. for streaming file transfer protocols.    A non transparent flow
  2219. control    is incompatible    with XMODEM and    YMODEM transfers.  XMODEM
  2220. and YMODEM protocols require complete transparency of all 256 8    bit
  2221. codes to operate properly.
  2222.  
  2223. The "best" flow    control    (when X.25 or hardware CTS is unavailable)
  2224. would not "eat"    any characters at all.    When the PAD's buffer almost
  2225. fills up, an XOFF should be emitted.  When the buffer is no longer
  2226. nearly full, send an XON.  Otherwise, the network should neither
  2227. generate nor eat XON or    XOFF control characters.
  2228.  
  2229. On Telenet, this can be    met by setting CCIT X3 5:1 and 12:0 at both
  2230. ends of    the network.  For best throughput, parameter 64    (advance
  2231. ACK) should be set to something    like 4.     Packets should    be forwarded
  2232. when the packet    is a full 128 bytes, or    after a    moderate delay
  2233. (3:0,4:10,6:0).
  2234.  
  2235. With PC-Pursuit, it is sufficient to set parameter 5 to    1 at both
  2236. ends after one is connected to the remote modem.
  2237.  
  2238.  
  2239.  
  2240. Chapter    15        Rev 8-3-87  Typeset 8-4-87            34
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248. Chapter    15             ZMODEM Protocol                35
  2249.  
  2250.  
  2251.  
  2252.     <ENTER>@<ENTER>
  2253.     set 5:1<ENTER>
  2254.     rst? 5:1<ENTER>
  2255.     cont<ENTER>
  2256.  
  2257. Unfortunately, many PADs do not    accept the "rst?" command.
  2258.  
  2259. For YMODEM, PAD    buffering should guarantee that    a minimum of 1040
  2260. characters can be sent in a burst without loss of data or generation
  2261. of flow    control    characters.  Failure to    provide    this buffering will
  2262. generate excessive retries with    YMODEM.
  2263.  
  2264.          TABLE 1.  Network and Flow    Control    Compatibility
  2265.  
  2266. ______________________________________________________________________________
  2267. |   Connectivity    |  Interactive|  XMODEM|  WXMODEM|    SUPERKERMIT|  ZMODEM |
  2268. ______________________________________________________________________________
  2269. |___________________|_____________|________|_________|_____________|_________|
  2270. |Direct    Connect        |  YES      |  YES   |  YES    |    YES       |  YES    |
  2271. |___________________|_____________|________|_________|_____________|_________|
  2272. |Network, no FC        |  no      |  YES   |  (4)    |    (6)       |  YES (1)|
  2273. |___________________|_____________|________|_________|_____________|_________|
  2274. |Net, transparent FC|  YES      |  YES   |  YES    |    YES       |  YES    |
  2275. |___________________|_____________|________|_________|_____________|_________|
  2276. |Net, non-trans. FC |  YES      |  no       |  no (5) |    YES       |  YES    |
  2277. |___________________|_____________|________|_________|_____________|_________|
  2278. |Network, 7 bit        |  YES      |  no       |  no     |    YES (2)       |  YES (3)|
  2279. |___________________|_____________|________|_________|_____________|_________|
  2280.  
  2281. (1) ZMODEM can optimize    window size or burst length for    fastest
  2282. transfers.
  2283. (2) Parity bits    must be    encoded, slowing binary    transfers.
  2284. (3) Natural protocol extension possible    for encoding data to 7 bits.
  2285. (4) Small WXMODEM window size may may allow operation.
  2286. (5) Some flow control codes are    not escaped in WXMODEM.
  2287. (6) Kermit window size must be reduced to avoid    buffer overrun.
  2288.  
  2289.  
  2290. 16.  PERFORMANCE COMPARISON TABLES
  2291.  
  2292.  
  2293. "Round Trip Delay Time"    includes the time for the last byte in a
  2294. packet to propagate through the    operating systems and network to the
  2295. receiver, plus the time    for the    receiver's response to that packet
  2296. to propagate back to the sender.
  2297.  
  2298. The figures shown below    are calculated for round trip delay times of
  2299. 40 milliseconds    and 5 seconds.    Shift registers    in the two computers
  2300. and a pair of 212 modems generate a round trip delay time on the
  2301. order of 40 milliseconds.  Operation with busy timesharing computers
  2302. and networks can easily    generate round trip delays of five seconds.
  2303.  
  2304.  
  2305.  
  2306. Chapter    16        Rev 8-3-87  Typeset 8-4-87            35
  2307.  
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314. Chapter    16             ZMODEM Protocol                36
  2315.  
  2316.  
  2317.  
  2318. Because    the round trip delays cause visible interruptions of data
  2319. transfer when using XMODEM protocol, the subjective effect of these
  2320. delays is greatly exaggerated, especially when the user    is paying
  2321. for connect time.
  2322.  
  2323. A 102400 byte binary file with randomly    distributed codes is sent at
  2324. 1200 bps 8 data    bits, 1    stop bit.  The calculations assume no
  2325. transmission errors.  For each of the protocols, only the per file
  2326. functions are considered.  Processor and I/O overhead are not
  2327. included.  YM-k    refers to YMODEM with 1024 byte    data packets.  YM-g
  2328. refers to the YMODEM "g" option.  ZMODEM uses 256 byte data
  2329. subpackets for this example.  SuperKermit uses maximum standard
  2330. packet size, 8 bit transparent transmission, no    run length
  2331. compression.  The 4 block WXMODEM window is too    small to span the 5
  2332. second delay in    this example; the resulting thoughput degradation is
  2333. ignored.
  2334.  
  2335. For comparison,    a straight "dump" of the file contents with no file
  2336. management or error checking takes 853 seconds.
  2337.  
  2338.          TABLE 2.  Protocol Overhead Information
  2339.        (102400 byte    binary file, 5 Second Round Trip)
  2340.  
  2341. ____________________________________________________________________________
  2342. |      Protocol          |     XMODEM|  YM-k |  YM-g|     ZMODEM|  SKermit|  WXMODEM|
  2343. ____________________________________________________________________________
  2344. |_____________________|________|_______|______|________|_________|_________|
  2345. |Protocol Round    Trips |     804   |  104  |  5   |     5     |  5     |  4       |
  2346. |_____________________|________|_______|______|________|_________|_________|
  2347. |Trip Time at 40ms    |     32s   |  4s   |  0   |     0     |  0     |  0       |
  2348. |_____________________|________|_______|______|________|_________|_________|
  2349. |Trip Time at 5s      |     4020s |  520s |  25s |     25s   |  25     |  20       |
  2350. ____________________________________________________________________________
  2351. |_____________________|________|_______|______|________|_________|_________|
  2352. |Overhead Characters  |     4803  |  603  |  503 |     3600  |  38280     |  8000   |
  2353. ____________________________________________________________________________
  2354. |_____________________|________|_______|______|________|_________|_________|
  2355. |Line Turnarounds     |     1602  |  204  |  5   |     5     |  2560     |  1602   |
  2356. ____________________________________________________________________________
  2357. |_____________________|________|_______|______|________|_________|_________|
  2358. |Transfer Time at 0s  |     893s  |  858s |  857s|     883s  |  1172s     |  916s   |
  2359. |_____________________|________|_______|______|________|_________|_________|
  2360. |Transfer Time at 40ms|     925s  |  862s |  857s|     883s  |  1172s     |  916s   |
  2361. |_____________________|________|_______|______|________|_________|_________|
  2362. |Transfer Time at 5s  |     5766s |  1378s|  882s|     918s  |  1197s     |  936s   |
  2363. |_____________________|________|_______|______|________|_________|_________|
  2364.  
  2365.  
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.  
  2372. Chapter    16        Rev 8-3-87  Typeset 8-4-87            36
  2373.  
  2374.  
  2375.  
  2376.  
  2377.  
  2378.  
  2379.  
  2380. Chapter    16             ZMODEM Protocol                37
  2381.  
  2382.  
  2383.  
  2384.          Figure    5.  Transmission Time Comparison
  2385.        (102400 byte    binary file, 5 Second Round Trip)
  2386.  
  2387. ************************************************** XMODEM
  2388. ************ YMODEM-K
  2389. ********** SuperKermit (Sliding    Windows)
  2390. *******    ZMODEM 16kb Segmented Streaming
  2391. *******    ZMODEM Full Streaming
  2392. *******    YMODEM-G
  2393.  
  2394.     TABLE 3.  Local    Timesharing Computer Download Performance
  2395.  
  2396. __________________________________________________________________________
  2397. |    Command    |  Protocol|  Time/HD|    Time/FD|  Throughput|  Efficiency|
  2398. __________________________________________________________________________
  2399. |_______________|__________|_________|_________|____________|____________|
  2400. |kermit    -x    |  Kermit  |  1:49   |    2:03   |  327        |  34%     |
  2401. |_______________|__________|_________|_________|____________|____________|
  2402. |sz -Xa    phones.t|  XMODEM  |  1:20   |    1:44   |  343        |  36%     |
  2403. |_______________|__________|_________|_________|____________|____________|
  2404. |sz -a phones.t    |  ZMODEM  |   :39   |     :48   |  915        |  95%     |
  2405. |_______________|__________|_________|_________|____________|____________|
  2406.  
  2407.  
  2408. Times were measured downloading    a 35721    character text file at 9600
  2409. bps, from Santa    Cruz SysV 2.1.2    Xenix on a 9 mHz IBM PC-AT to DOS
  2410. 2.1 on an IBM PC.  Xenix was in    multiuser mode but otherwise idle.
  2411. Transfer times to PC hard disk and floppy disk destinations are
  2412. shown.
  2413.  
  2414. C-Kermit 4.2(030) used server mode and file compression, sending to
  2415. Pro-YAM    15.52 using 0 delay and    a "get phones.t" command.
  2416.  
  2417. Crosstalk XVI 3.6 used XMODEM 8    bit checksum (CRC not available) and
  2418. an "ESC    rx phones.t" command.  The Crosstalk time does not include
  2419. the time needed    to enter the extra commands not    needed by Kermit and
  2420. ZMODEM.
  2421.  
  2422. Professional-YAM used ZMODEM AutoDownload.  ZMODEM times included a
  2423. security challenge to the sending program.
  2424.  
  2425.  
  2426.  
  2427.  
  2428.  
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436.  
  2437.  
  2438. Chapter    16        Rev 8-3-87  Typeset 8-4-87            37
  2439.  
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446. Chapter    16             ZMODEM Protocol                38
  2447.  
  2448.  
  2449.  
  2450.               TABLE 4.    File Transfer Speeds
  2451.  
  2452. ________________________________________________________________________________
  2453. | Prot          file     bytes      bps      ch/sec           Notes           |
  2454. ________________________________________________________________________________
  2455. |X      jancol.c     18237      2400     53         Tymnet PTL    5/3/87           |
  2456. |X      source.xxx     6143      2400     56         Source/Telenet PTL    5/29/87|
  2457. |X      jancol.c     18237      2400     64         Tymnet PTL               |
  2458. |XN      c-format.arc     18432      1200     84         GEnie PTL               |
  2459. |B      jancol.c     18237      1200     87         DataPac (604-687-7144)    |
  2460. |B/ovth      emaibm.arc     51200      1200     101         CIS PTL MNP           |
  2461. |ZM      jancol.c     18237      1200     112         DataPac (604-687-7144)    |
  2462. |X/ovth      emaibm.arc     51200      1200     114         CIS PTL MNP           |
  2463. |ZM      emaibm.arc     51200      1200     114         CIS PTL MNP           |
  2464. |B      jancol.c     18237      2400     124         Tymnet PTL               |
  2465. |B      YI0515.87     9081      2400     157         CIS PTL node 5/29/87      |
  2466. |SK      source.xxx     6143      2400     170         Source/Telenet PTL    5/29/87|
  2467. |ZM      jancol.c     18237      2400     221         Tymnet PTL    upl/dl           |
  2468. |ZM      jancol.c     18237      2400     224         Tymnet PTL               |
  2469. |ZM      jancol.c     18237      2400     226/218     TeleGodzilla upl           |
  2470. |ZM      jancol.c     18237      2400     226         Tymnet PTL    5/3/87           |
  2471. |ZM      zmodem.ov     35855      2400     227         CIS PTL node           |
  2472. |C      jancol.c     18237      2400     229         Tymnet PTL    5/3/87           |
  2473. |ZM      jancol.c     18237      2400     229/221     TeleGodzilla           |
  2474. |ZM      zmodem.ov     35855      2400     229         CIS PTL node upl           |
  2475. |ZM      jancol.c     18237      2400     232         CIS PTL node           |
  2476. |ZM      mbox         473104      9600     948/942     TeleGodzilla upl           |
  2477. |ZM      zmodem.arc     318826      14k     1357/1345   TeleGodzilla           |
  2478. |ZM      mbox         473104      14k     1367/1356   TeleGodzilla upl           |
  2479. |ZM      c2.doc     218823      38k     3473         Xenix 386 Toolkit upl     |
  2480. |ZM      mbox         511893      38k     3860         386 Xenix 2.2 Beta    #      |
  2481. |ZM      c.doc         218823      57k     5611         **                   |
  2482. |______________________________________________________________________________|
  2483.  
  2484. Times are for downloads    unless noted.  Where two speeds    are noted,
  2485. the faster speed is reported by    the receiver because its transfer
  2486. time calculation excludes the security check and transaction log
  2487. file processing.  The TeleGodzilla computer is a 4.77 mHz IBM PC
  2488. with a 10 MB hard disk.     The 386 computer uses an Intel    motherboard
  2489. at 18 mHz 1ws.    The AT Clone (QIC) runs    at 8 mHz 0ws.
  2490. Abbreviations:
  2491.  B     Compuserve B Protocol
  2492.  B/ovth              CIS B with Omen Technology OverThruster(TM)
  2493.  C     Capture DC2/DC4 (no protocol)
  2494.  K     Kermit
  2495.  MNP   Microcom    MNP error correcting SX/1200 modem
  2496.  PTL   Portland    Oregon network node
  2497.  SK    Sliding Window Kermit (SuperKermit) w=15
  2498.  X     XMODEM
  2499.  XN    XMODEM protocol implemented in network modes
  2500.  X/ovth              XMODEM, Omen Technology OverThruster(TM)
  2501.  
  2502.  
  2503.  
  2504. Chapter    16        Rev 8-3-87  Typeset 8-4-87            38
  2505.  
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512. Chapter    16             ZMODEM Protocol                39
  2513.  
  2514.  
  2515.  
  2516.  ZM    ZMODEM
  2517.  Tk    Xenix 386 Toolkit, rz compiled -M3, dumb    serial port
  2518.  **    AT Clone    ramdisk    to 386 ramdisk,    or either ramdisk to nul
  2519.  #     On the fly format translation NL    to CR/LF
  2520.                TABLE 5.     Protocol Checklist
  2521.  
  2522. _________________________________________________________________________
  2523. |Item               XMODEM  WXMODEM    YMDM-k     YMDM-g     ZMODEM     SKermit|
  2524. _________________________________________________________________________
  2525. |IN SERVICE        |  1977  | 1986   |    1982   | 1985  | 1986  | 1985    |
  2526. |___________________|________|________|________|_______|_______|________|
  2527. |USER FEATURES        |         |          |           |       |       |    |
  2528. |User Friendly I/F  |  -     | -      |    -      | -     | YES   | -    |
  2529. |Commands/batch        |  2*N   | 2*N    |    2      | 2     | 1     | 1(1)    |
  2530. |Commands/file        |  2     | 2      |    0      | 0     | 0     | 0    |
  2531. |Command Download   |  -     | -      |    -      | -     | YES   | YES(6)    |
  2532. |Menu Compatible    |  -     | -      |    -      | -     | YES   | -    |
  2533. |Transfer Recovery  |  -     | -      |    -      | -     | YES   | -    |
  2534. |File Management    |  -     | -      |    -      | -     | YES   | -    |
  2535. |Security Check        |  -     | -      |    -      | -     | YES   | -    |
  2536. |YMODEM    Fallback    |  YES   | YES    |    YES    | YES   | YES   | -    |
  2537. |___________________|________|________|________|_______|_______|________|
  2538. |COMPATIBILITY        |         |          |           |       |       |    |
  2539. |Dynamic Files        |  YES   | YES    |    FAIL   | FAIL  | YES   | YES    |
  2540. |Packet    SW NETS        |  -     | YES    |    -      | -     | YES   | YES    |
  2541. |7 bit PS NETS        |  -     | -      |    -      | -     | (8)   | YES    |
  2542. |Old Mainframes        |  -     | -      |    -      | -     | (8)   | YES    |
  2543. |CP/M-80        |  YES   | YES    |    YES    | -     | YES(9)| -    |
  2544. |___________________|________|________|________|_______|_______|________|
  2545. |ATTRIBUTES        |         |          |           |       |       |    |
  2546. |Reliability(5)        |  fair  | poor   |    fair(5)| none  | BEST  | HIGH    |
  2547. |Streaming        |  -     | YES    |    -      | YES   | YES   | YES    |
  2548. |Overhead(2)        |  7%    | 7%     |    1%     | 1%    | 1%    | 30%    |
  2549. |Faithful Xfers        |  -     | -      |    YES    | YES   | YES   | YES    |
  2550. |Preserve Date        |  -     | -      |    YES    | YES   | YES   | -    |
  2551. |___________________|________|________|________|_______|_______|________|
  2552. |COMPLEXITY        |         |          |           |       |       |    |
  2553. |No-Wait Sample        |  -     | REQD   |    -      | -     | opt   | REQD    |
  2554. |Ring Buffers        |  -     | REQD   |    -      | -     | opt   | REQD    |
  2555. |XMODEM    Similar        |  YES   | LOW    |    HIGH   | HIGH  | LOW   | NONE    |
  2556. |Complexity        |  LOW(5)| MED    |    LOW(5) | LOW   | MED   | HIGH    |
  2557. |___________________|________|________|________|_______|_______|________|
  2558. |EXTENSIONS        |         |          |           |       |       |    |
  2559. |Server    Operation   |  -     | -      |    -      | -     | YES(4)| YES    |
  2560. |Multiple Threads   |  -     | -      |    -      | -     | future| -    |
  2561. _________________________________________________________________________
  2562.  
  2563. NOTES:
  2564. (1) Server mode    or Omen    Technology Kermit AutoDownload
  2565. (2) Character count, binary file, transparent channel
  2566. (3) 32 bit math    needed for accurate transfer (no garbage added)
  2567.  
  2568.  
  2569.  
  2570. Chapter    16        Rev 8-3-87  Typeset 8-4-87            39
  2571.  
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578. Chapter    16             ZMODEM Protocol                40
  2579.  
  2580.  
  2581.  
  2582. (4) AutoDownload operation
  2583. (5) Cybernetic Data Recovery(TM) improves XMODEM and YMODEM
  2584. reliability with complex proprietary logic.
  2585. (6) Server commands only
  2586. (7) No provision for transfers across time zones
  2587. (8) Future enhancement provided    for
  2588. (9) With Segmented Streaming
  2589. WXMODEM: XMODEM    derivative protocol with data encoding and windowing
  2590.  
  2591.  
  2592.  
  2593.  
  2594.  
  2595.  
  2596.  
  2597.  
  2598.  
  2599.  
  2600.  
  2601.  
  2602.  
  2603.  
  2604.  
  2605.  
  2606.  
  2607.  
  2608.  
  2609.  
  2610.  
  2611.  
  2612.  
  2613.  
  2614.  
  2615.  
  2616.  
  2617.  
  2618.  
  2619.  
  2620.  
  2621.  
  2622.  
  2623.  
  2624.  
  2625.  
  2626.  
  2627.  
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635.  
  2636. Chapter    16        Rev 8-3-87  Typeset 8-4-87            40
  2637.  
  2638.  
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644. Chapter    16             ZMODEM Protocol                41
  2645.  
  2646.  
  2647.  
  2648. 17.  FUTURE EXTENSIONS
  2649.  
  2650. Future extensions include:
  2651.  
  2652.    + Compatibility with    7 bit networks
  2653.  
  2654.    + Server/Link Level operation: An END-TO-END    error corrected
  2655.      program to    program    session    is required for    financial and other
  2656.      sensitive applications.
  2657.  
  2658.    + Multiple independent threads
  2659.  
  2660.    + Encryption
  2661.  
  2662.    + Compression
  2663.  
  2664.    + File Comparison
  2665.  
  2666.    + Selective transfer    within a file (e.g., modified segments of a
  2667.      database file)
  2668.  
  2669.    + Selective Retransmission for error    correction
  2670.  
  2671.  
  2672. 18.  REVISIONS
  2673.  
  2674. 07-31-1987 The receiver    should ignore a    ZEOF with an offset that
  2675. does not match the current file    length.     The previous action of
  2676. responding with    ZRPOS caused transfers to fail if a CRC    error
  2677. occurred immediately before end    of file, because two retransmission
  2678. requests were being sent for each error.  This has been    observed
  2679. under exceptional conditions, such as data transmission    at speeds
  2680. greater    than the receiving computer's interrupt    response capabilitiy
  2681. or gross misapplication    of flow    control.
  2682.  
  2683. Discussion of the Tx backchannel garbage count and ZCRCW after error
  2684. ZRPOS was added.  Many revisions for clarity.
  2685. 07-09-87 Corrected XMODEM's development    date, incorrectly stated as
  2686. 1979 instead of    the actual August 1977.     More performance data was
  2687. added.
  2688. 05-30-87 Added ZMNEW and ZMSKNOLOC
  2689. 05-14-87 Window    management, ZACK zshhdr    XON removed, control
  2690. character escaping, ZMSPARS changed to ZXPARS, editorial changes.
  2691. 04-13-87  The ZMODEM file transfer protocol's public domain status
  2692. is emphasized.
  2693. 04-04-87: minor    editorial changes, added conditionals for overview
  2694. version.
  2695. 03-15-87: 32 bit CRC added.
  2696. 12-19-86: 0 Length ZCRCW data subpacket    sent in    response to ZPAD or
  2697. ZDELE detected on reverse channel has been changed to ZCRCE.  The
  2698. reverse    channel    is now checked for activity before sending each
  2699.  
  2700.  
  2701.  
  2702. Chapter    18        Rev 8-3-87  Typeset 8-4-87            41
  2703.  
  2704.  
  2705.  
  2706.  
  2707.  
  2708.  
  2709.  
  2710. Chapter    18             ZMODEM Protocol                42
  2711.  
  2712.  
  2713.  
  2714. ZDATA header.
  2715. 11-08-86: Minor    changes    for clarity.
  2716. 10-2-86:  ZCNL definition expanded.
  2717. 9-11-86:  ZMPROT file management option    added.
  2718. 8-20-86:  More performance data    included.
  2719. 8-4-86:     ASCII DLE (Ctrl-P, 020) now escaped; compatible with
  2720. previous versions.  More document revisions for    clarity.
  2721. 7-15-86: This document was extensively edited to improve clarity and
  2722. correct    small errors.  The definition of the ZMNEW management option
  2723. was modified, and the ZMDIFF management    option was added.  The
  2724. cancel sequence    was changed from two to    five CAN characters after
  2725. spurious two character cancel sequences    were detected.
  2726.  
  2727.  
  2728. 19.  MORE INFORMATION
  2729.  
  2730. Please contact Omen Technology for troff source    files and typeset
  2731. copies of this document.
  2732.  
  2733.  
  2734. 19.1  TeleGodzilla Bulletin Board
  2735.  
  2736. More information may be    obtained by calling the    TeleGodzilla
  2737. bulletin board at 503-621-3746.     TeleGodzilla supports 2400 and    1200
  2738. bps callers with automatic speed recognition.  Once connected,
  2739. Telebit    TrailBlazer uses can keyboard
  2740.             trailblazer
  2741. to switch the modems to    high speed (19kb) operation.
  2742.  
  2743. Relevant files include YZMODEM.ZOO, YAMDEMO.ZOO, YAMHELP.ZOO,
  2744. ZCOMMEXE.ARC, ZCOMMDOC.ARC, ZCOMMHLP.ARC, and YMODEM.DQC.
  2745.  
  2746. Useful commands    for TeleGodzilla include "menu", "dir",    "sx file
  2747. (XMODEM)", "kermit sb file ...", and "sz file ...".
  2748.  
  2749. 19.2  Unix UUCP    Access
  2750.  
  2751. UUCP sites can obtain the current version of this file with
  2752.           uucp omen!/u/caf/public/zmodem.doc /tmp
  2753. A continually updated list of available    files is stored    in
  2754. /usr/spool/uucppublic/FILES.
  2755.        uucp     omen!~uucp/FILES   /usr/spool/uucppublic
  2756.  
  2757. The following L.sys line allows    UUCP to    call site "omen" via Omen's
  2758. bulletin board system "TeleGodzilla".  TeleGodzilla is an instance
  2759. of Omen    Technology's Professional-YAM in host operation, acting    as a
  2760. bulletin board and front ending    a Xenix    system.
  2761.  
  2762. In response to TeleGodzilla's "Name Please:" (e:--e:), uucico gives
  2763. the Pro-YAM "link" command as a    user name.  Telegodzilla then asks
  2764. for a link password (d:).  The password    (Giznoid) controls access to
  2765.  
  2766.  
  2767.  
  2768. Chapter    19        Rev 8-3-87  Typeset 8-4-87            42
  2769.  
  2770.  
  2771.  
  2772.  
  2773.  
  2774.  
  2775.  
  2776. Chapter    19             ZMODEM Protocol                43
  2777.  
  2778.  
  2779.  
  2780. the Xenix system connected to the IBM PC's other serial    port.
  2781. Communications between Pro-YAM and Xenix use 9600 bps; YAM converts
  2782. this to    the caller's speed.
  2783.  
  2784. Finally, the calling uucico sees the Xenix "Login:" message (n:--
  2785. n:), and logs in as "uucp".  No    password is used for the uucp
  2786. account.
  2787.  
  2788. omen Any ACU 2400 1-503-621-3746 e:--e:    link d:    Giznoid    n:--n: uucp
  2789.  
  2790.  
  2791.  
  2792. 20.  ZMODEM PROGRAMS
  2793.  
  2794. A copy of this document, a demonstration version of
  2795. Professional-YAM, a flash-up tree structured help file and
  2796. processor, are available in YZMODEM.ZOO    on TeleGodzilla    and other
  2797. bulletin boards.  This file must be unpacked with LOOZ.EXE, also
  2798. available on TeleGodzilla.  YZMODEM.ZOO    may be distributed provided
  2799. none of    the files are deleted or modified without the written
  2800. consent    of Omen    Technology.
  2801.  
  2802. TeleGodzilla and other bulletin    boards also feature ZCOMM, a
  2803. shareware communications program.  ZCOMM includes Omen Technology's
  2804. TurboLearn(TM) Script Writer, ZMODEM, Omen's highly acclaimed XMODEM
  2805. and YMODEM protocol support, Sliding Windows Kermit, several
  2806. traditional protocols, a powerful script language, and the most
  2807. accurate VT100/102 emulation available in a usr    supported program.
  2808. The ZCOMM files    include:
  2809.  
  2810.   + ZCOMMEXE.ARC Executable files and beginner's telephone directory
  2811.  
  2812.   + ZCOMMDOC.ARC "Universal Line Printer Edition" Manual
  2813.  
  2814.   + ZCOMMHLP.ARC Tree structured Flash-UP help processor and
  2815.     database
  2816.  
  2817. Source code and    manual pages for the Unix/Xenix    rz and sz programs
  2818. are available on TeleGodzilla in RZSZ.ZOO.  This ZOO archive may be
  2819. unpacked with LOOZ.EXE,    also available on TeleGodzilla.     Most Unix
  2820. like systems are supported, including V7, Sys III, 4.x BSD, SYS    V,
  2821. Idris, Coherent, and Regulus.
  2822.  
  2823. RZSZ.ZOO includes a ZCOMM/Pro-YAM/PowerCom script ZUPL.T to upload
  2824. the small (178 lines) YMODEM bootstrap program MINIRB.C    without    a
  2825. file transfer protocol.     MINIRB    uses the Unix stty(1) program to set
  2826. the required raw tty modes, and    compiles without special flags on
  2827. virtually all Unix and Xenix systems.  ZUPL.T directs the Unix
  2828. system to compile MINIRB, then uses it as a bootstrap to upload    the
  2829. rz/sz source and manual    files.
  2830.  
  2831.  
  2832.  
  2833.  
  2834. Chapter    20        Rev 8-3-87  Typeset 8-4-87            43
  2835.  
  2836.  
  2837.  
  2838.  
  2839.  
  2840.  
  2841.  
  2842. Chapter    20             ZMODEM Protocol                44
  2843.  
  2844.  
  2845.  
  2846. The PC-DOS Opus    bulletin board supports    ZMODEM.     Integrated ZMODEM
  2847. support    for the    Collie bulletin    board program is planned.
  2848.  
  2849. A number of other bulletin board programs support ZMODEM with
  2850. external modules (DSZ, etc.).
  2851.  
  2852. The PC-DOS Teleconferencing system IN-SYNCH uses ZMODEM.
  2853.  
  2854. Other PC-DOS communications programs with ZMODEM support modules
  2855. include    QMODEM and BOYAN.  Crosstalk is    believed to be adding ZMODEM
  2856. to Mark    IV.
  2857.  
  2858. The ZMDM communications    program    by Jwahar Bammi    runs on    Atari ST
  2859. machines.
  2860.  
  2861. A program for the Amiga    is also    in development.
  2862.  
  2863. The Compuserve Information Service has ported the Unix rz/sz ZMODEM
  2864. programs to DECSYSTEM 20 assembler.
  2865.  
  2866. 20.1  Adding ZMODEM to DOS Programs
  2867.  
  2868. DSZ is a small program that supports XMODEM, YMODEM, and ZMODEM    file
  2869. transfers.  DSZ    is designed to be called from a    bulletin board
  2870. program    or another communications program.  It may be called as
  2871.              dsz port 2    sz file1 file2
  2872. to send    files, or as
  2873.                dsz port 2 rz
  2874. to receive zero    or more    file(s), or as
  2875.              dsz port 2    rz filea fileb
  2876. to receive two files, the first    to filea and the second    (if sent) to
  2877. fileb.    This form of dsz may be    used to    control    the pathname of
  2878. incoming file(s).  In this example, if the sending program attempted
  2879. to send    a third    file, the transfer would be terminated.
  2880.  
  2881. Dsz uses DOS stdout for    messages (no direct CRT    access), acquires
  2882. the COMM port vectors with standard DOS    calls, and restores the    COMM
  2883. port's interrupt vector    and registers upon exit.
  2884.  
  2885. Further    information on dsz may be found    in dsz.doc and the ZCOMM or
  2886. Pro-YAM    user manuals.
  2887.  
  2888.  
  2889. 21.  YMODEM PROGRAMS
  2890.  
  2891. The Unix rz/sz programs    support    YMODEM as well as ZMODEM.  Most    Unix
  2892. like systems are supported, including V7, Sys III, 4.2 BSD, SYS    V,
  2893. Idris, Coherent, and Regulus.
  2894.  
  2895. A version for VAX-VMS is available in VRBSB.SHQ, in the    same
  2896. directory.
  2897.  
  2898.  
  2899.  
  2900. Chapter    21        Rev 8-3-87  Typeset 8-4-87            44
  2901.  
  2902.  
  2903.  
  2904.  
  2905.  
  2906.  
  2907.  
  2908. Chapter    21             ZMODEM Protocol                45
  2909.  
  2910.  
  2911.  
  2912. Irv Hoff has added 1k packets and YMODEM transfers to the KMD and
  2913. IMP series programs, which replace the XMODEM and MODEM7/MDM7xx
  2914. series respectively.  Overlays are available for a wide    variety    of
  2915. CP/M systems.
  2916.  
  2917. Many other programs, including MEX-PLUS    and Crosstalk Mark IV also
  2918. support    some of    YMODEM's features.
  2919.  
  2920. Questions about    YMODEM,    the Professional-YAM communications program,
  2921. and requests for evaluation copies may be directed to:
  2922.  
  2923.      Chuck Forsberg
  2924.      Omen Technology Inc
  2925.      17505-V Sauvie Island Road
  2926.      Portland Oregon 97231
  2927.      VOICE: 503-621-3406 :VOICE
  2928.      Modem (TeleGodzilla): 503-621-3746
  2929.      Usenet: ...!tektronix!reed!omen!caf
  2930.      Compuserve: 70007,2304
  2931.      Source: TCE022
  2932.  
  2933.  
  2934. 22.  ACKNOWLEDGMENTS
  2935.  
  2936. ZMODEM was developed for the public domain under a Telenet contract.
  2937. The ZMODEM protocol descriptions and the Unix rz/sz program source
  2938. code are public    domain.     No licensing, trademark, or copyright
  2939. restrictions apply to the use of the protocol, the Unix    rz/sz source
  2940. code and the ZMODEM name.
  2941.  
  2942. Encouragement and suggestions by Thomas    Buck, Ward Christensen,    Earl
  2943. Hall, Irv Hoff,    Stuart Mathison, and John Wales, are gratefully
  2944. acknowledged.  32 bit CRC code courtesy    Gary S.    Brown.
  2945.  
  2946.  
  2947. 23.  RELATED FILES
  2948.  
  2949. The following files may    be useful while    studying this document:
  2950.  
  2951. YMODEM.DOC Describes the XMODEM, XMODEM-1k, and    YMODEM batch file
  2952.     transfer protocols.  This file is available on TeleGodzilla
  2953.     as YMODEM.DQC.
  2954.  
  2955. zmodem.h Definitions for ZMODEM    manifest constants
  2956.  
  2957. rz.c, sz.c, rbsb.c Unix    source code for    operating ZMODEM programs.
  2958.  
  2959. rz.1, sz.1 Manual pages    for rz and sz (Troff sources).
  2960.  
  2961. zm.c    Operating system independent low level ZMODEM subroutines.
  2962.  
  2963.  
  2964.  
  2965.  
  2966. Chapter    23        Rev 8-3-87  Typeset 8-4-87            45
  2967.  
  2968.  
  2969.  
  2970.  
  2971.  
  2972.  
  2973.  
  2974. Chapter    23             ZMODEM Protocol                46
  2975.  
  2976.  
  2977.  
  2978. minirb.c A YMODEM bootstrap program, 178 lines.
  2979.  
  2980. RZSZ.ZOO,rzsz.arc Contain the C    source code and    manual pages listed
  2981.     above, plus a ZCOMM script to upload minirb.c to a Unix    or
  2982.     Xenix system, compile it, and use the program to upload    the
  2983.     ZMODEM source files with error checking.
  2984.  
  2985. DSZ.ZOO,dsz.arc    Contains DSZ.COM, a shareware X/Y/ZMODEM subprogram,
  2986.     DESQview "pif" files for background operation in minimum
  2987.     memory,    and DSZ.DOC.
  2988.  
  2989. ZCOMM*.ARC Archive files for ZCOMM, a powerful shareware
  2990.     communications program.
  2991.  
  2992.  
  2993.  
  2994.  
  2995.  
  2996.  
  2997.  
  2998.  
  2999.  
  3000.  
  3001.  
  3002.  
  3003.  
  3004.  
  3005.  
  3006.  
  3007.  
  3008.  
  3009.  
  3010.  
  3011.  
  3012.  
  3013.  
  3014.  
  3015.  
  3016.  
  3017.  
  3018.  
  3019.  
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.  
  3027.  
  3028.  
  3029.  
  3030.  
  3031.  
  3032. Chapter    23        Rev 8-3-87  Typeset 8-4-87            46
  3033.  
  3034.  
  3035.  
  3036.  
  3037.  
  3038.  
  3039.  
  3040.  
  3041.  
  3042.  
  3043.  
  3044.                   CONTENTS
  3045.  
  3046.  
  3047.  1.  INTENDED AUDIENCE................................................     2
  3048.  
  3049.  2.  WHY DEVELOP ZMODEM?..............................................     2
  3050.  
  3051.  3.  ZMODEM Protocol Design Criteria..................................     4
  3052.      3.1    Ease of Use...............................................     4
  3053.      3.2    Throughput................................................     5
  3054.      3.3    Integrity and Robustness..................................     6
  3055.      3.4    Ease of Implementation....................................     6
  3056.  
  3057.  4.  EVOLUTION OF ZMODEM..............................................     7
  3058.  
  3059.  5.  ROSETTA STONE....................................................    10
  3060.  
  3061.  6.  ZMODEM REQUIREMENTS..............................................    10
  3062.      6.1    File Contents.............................................    10
  3063.  
  3064.  7.  ZMODEM BASICS....................................................    12
  3065.      7.1    Packetization.............................................    12
  3066.      7.2    Link Escape    Encoding......................................    12
  3067.      7.3    Header....................................................    13
  3068.      7.4    Binary Data    Subpackets....................................    16
  3069.      7.5    ASCII Encoded Data Subpacket..............................    16
  3070.  
  3071.  8.  PROTOCOL TRANSACTION OVERVIEW....................................    16
  3072.      8.1    Session Startup...........................................    16
  3073.      8.2    File Transmission.........................................    18
  3074.      8.3    Session Cleanup...........................................    20
  3075.      8.4    Session Abort Sequence....................................    20
  3076.  
  3077.  9.  STREAMING TECHNIQUES / ERROR RECOVERY............................    21
  3078.      9.1    Full Streaming with    Sampling..............................    21
  3079.      9.2    Full Streaming with    Reverse    Interrupt.....................    23
  3080.      9.3    Full Streaming with    Sliding    Window........................    23
  3081.      9.4    Full Streaming over    Error Free Channels...................    24
  3082.      9.5    Segmented Streaming.......................................    24
  3083.  
  3084. 10.  ATTENTION SEQUENCE...............................................    24
  3085.  
  3086. 11.  FRAME TYPES......................................................    25
  3087.      11.1   ZRQINIT...................................................    25
  3088.      11.2   ZRINIT....................................................    25
  3089.      11.3   ZSINIT....................................................    25
  3090.      11.4   ZACK......................................................    26
  3091.      11.5   ZFILE.....................................................    26
  3092.      11.6   ZSKIP.....................................................    28
  3093.      11.7   ZNAK......................................................    28
  3094.      11.8   ZABORT....................................................    28
  3095.  
  3096.  
  3097.  
  3098.                   - i -
  3099.  
  3100.  
  3101.  
  3102.  
  3103.  
  3104.  
  3105.  
  3106.  
  3107.  
  3108.  
  3109.  
  3110.      11.9   ZFIN......................................................    28
  3111.      11.10  ZRPOS.....................................................    28
  3112.      11.11  ZDATA.....................................................    29
  3113.      11.12  ZEOF......................................................    29
  3114.      11.13  ZFERR.....................................................    29
  3115.      11.14  ZCRC......................................................    29
  3116.      11.15  ZCHALLENGE................................................    29
  3117.      11.16  ZCOMPL....................................................    29
  3118.      11.17  ZCAN......................................................    29
  3119.      11.18  ZFREECNT..................................................    29
  3120.      11.19  ZCOMMAND..................................................    29
  3121.  
  3122. 12.  SESSION TRANSACTION EXAMPLES.....................................    30
  3123.      12.1   A simple file transfer....................................    30
  3124.      12.2   Challenge and Command Download............................    31
  3125.  
  3126. 13.  ZFILE FRAME FILE INFORMATION.....................................    31
  3127.  
  3128. 14.  PERFORMANCE RESULTS..............................................    33
  3129.      14.1   Compatibility.............................................    33
  3130.      14.2   Throughput................................................    33
  3131.      14.3   Error Recovery............................................    33
  3132.  
  3133. 15.  PACKET SWITCHED NETWORK CONSIDERATIONS...........................    34
  3134.  
  3135. 16.  PERFORMANCE COMPARISON TABLES....................................    35
  3136.  
  3137. 17.  FUTURE EXTENSIONS................................................    41
  3138.  
  3139. 18.  REVISIONS........................................................    41
  3140.  
  3141. 19.  MORE INFORMATION.................................................    42
  3142.      19.1   TeleGodzilla Bulletin Board...............................    42
  3143.      19.2   Unix UUCP Access..........................................    42
  3144.  
  3145. 20.  ZMODEM PROGRAMS..................................................    43
  3146.      20.1   Adding ZMODEM to DOS Programs.............................    44
  3147.  
  3148. 21.  YMODEM PROGRAMS..................................................    44
  3149.  
  3150. 22.  ACKNOWLEDGMENTS..................................................    45
  3151.  
  3152. 23.  RELATED FILES....................................................    45
  3153.  
  3154.  
  3155. LIST OF    FIGURES
  3156.  
  3157.  
  3158. Figure 1.  Order of Bytes in Header...................................    14
  3159.  
  3160. Figure 2.  16 Bit CRC Binary Header...................................    14
  3161.  
  3162.  
  3163.  
  3164.                   - ii -
  3165.  
  3166.  
  3167.  
  3168.  
  3169.  
  3170.  
  3171.  
  3172.  
  3173.  
  3174.  
  3175.  
  3176. Figure 3.  32 Bit CRC Binary Header...................................    14
  3177.  
  3178. Figure 4.  HEX Header.................................................    15
  3179.  
  3180. Figure 5.  Transmission    Time Comparison...............................    37
  3181.  
  3182.  
  3183. LIST OF    TABLES
  3184.  
  3185.  
  3186. TABLE 1.  Network and Flow Control Compatibility......................    35
  3187.  
  3188. TABLE 2.  Protocol Overhead Information...............................    36
  3189.  
  3190. TABLE 3.  Local    Timesharing Computer Download Performance.............    37
  3191.  
  3192. TABLE 4.  File Transfer    Speeds........................................    38
  3193.  
  3194. TABLE 5.  Protocol Checklist..........................................    39
  3195.  
  3196.  
  3197.  
  3198.  
  3199.  
  3200.  
  3201.  
  3202.  
  3203.  
  3204.  
  3205.  
  3206.  
  3207.  
  3208.  
  3209.  
  3210.  
  3211.  
  3212.  
  3213.  
  3214.  
  3215.  
  3216.  
  3217.  
  3218.  
  3219.  
  3220.  
  3221.  
  3222.  
  3223.  
  3224.  
  3225.  
  3226.  
  3227.  
  3228.  
  3229.  
  3230.                  - iii -
  3231.  
  3232.  
  3233.  
  3234.  
  3235.  
  3236.  
  3237.  
  3238.  
  3239.  
  3240.        The ZMODEM Inter Application    File Transfer Protocol
  3241.  
  3242.                   Chuck Forsberg
  3243.  
  3244.                Omen    Technology Inc
  3245.  
  3246.  
  3247.                  ABSTRACT
  3248.  
  3249.  
  3250.  
  3251. The ZMODEM file    transfer protocol provides reliable file and command
  3252. transfers with complete    END-TO-END data    integrity between application
  3253. programs.  ZMODEM's 32 bit CRC catches errors that continue to sneak into
  3254. even the most advanced networks.
  3255.  
  3256. ZMODEM rapidly transfers files,    particularly with buffered (error
  3257. correcting) modems, timesharing    systems, satellite relays, and wide area
  3258. packet switched    networks.
  3259.  
  3260. ZMODEM greatly simplifies file transfers compared to XMODEM.  In addition
  3261. to a friendly user interface, ZMODEM provides Personal Computer    and other
  3262. users an efficient, accurate, and robust file transfer method.
  3263.  
  3264. ZMODEM provides    advanced file management features including AutoDownload
  3265. (Automatic file    Download initiated without user    intervention), Crash
  3266. Recovery, selective file transfers, and    security verified command
  3267. downloading.
  3268.  
  3269. ZMODEM protocol    features allow implementation on a wide    variety    of systems
  3270. operating in a wide variety of environments.  A    choice of buffering and
  3271. windowing modes    allows ZMODEM to operate on systems that cannot    support
  3272. other streaming    protocols.  Finely tuned control character escaping allows
  3273. operation with real world networks without Kermit's high overhead.
  3274.  
  3275. Although ZMODEM    software is more complex than unreliable XMODEM    routines,
  3276. actual C source    code to    production programs allows developers to upgrade
  3277. their applications with    efficient, reliable ZMODEM file    transfers with a
  3278. minimum    of effort.
  3279.  
  3280. ZMODEM is carefully designed to    provide    these benefits using a minimum of
  3281. new software technology.  ZMODEM can be    implemented on all but the most
  3282. brain damaged computers.
  3283.  
  3284. ZMODEM was developed for the public domain under a Telenet contract.  The
  3285. ZMODEM protocol    descriptions and the Unix rz/sz    program    source code are
  3286. public domain.    No licensing, trademark, or copyright restrictions apply
  3287. to the use of the protocol, the    Unix rz/sz source code and the ZMODEM
  3288. name.
  3289.