
 [70000,764]+ XMODEM.DOC     23-Oct-84 26920        522  A     Keywords: XMODEM CHRISTIANSEN PROTOCOL COMPUSERVE CIS MODEMC     TELECOMMUNICATIONS     H     This is Compuserve's own document describing the type of XMODEM or2     Christiansen Protocol available on the SIGs.O -----------------------------------------------------------------------------C "4                              XMODEM and COMPUSERVE 0                                  October, 1984   >                     NOTE:  XMODEM,  like  the  rest  of  the>                     CompuServe   Information   Service,   is>                     provided  on  an  "as-is,  as-available"                     basis.  4                              Questions and Answers4                              --------------------- F           Question: Why doesn't XMODEM work with my PC-Talk program?H           Answer:   PC-Talk  works   just   fine   with   CompuServe'sH                     implementation of the  XMODEM  protocol,  but  youH                     need to be running 8 bits / no parity in order for+                     PC-Talk to do XMODEM.S!           See:      Section 4.2s  H           Question: I download a file using XMODEM, but all I get  areH                     a bunch of hexidecimal characters (something like:=                     :1800100AB759CDEF7) What I doing wrong?XH           Answer:   You need to specify that  you  are  downloading  aH                     binary file, rather than a text file.  You can  doH                     this by appending a "/type:bin"  in  the  download+                     command (for example:-@                          dow chess.bin/proto:XMODEM/type:bin )H                     or by selecting transfer type 2 (Binary) from  the$                     download menu.!           See:      Section 3.2m  H           Question: I download a file using XMODEM, but all I get is a6                     very short file full of garbage.H           Answer:   You may be trying to download an ASCII (text) fileH                     as if it were a binary file.  Append "/type:ascii"H                     to the  filename  in  the  download  command  (for                     example:@                          dow chess.txt/proto:XMODEM/type:asciiH                     or  select  transfer  type  1  (ASCII)  from   the$                     download menu.!           See:      Section 3.2n  H           Question: My   Crosstalk   program   doesn't    work    with*                     CompuServe's XMODEM!H           Answer:   Crosstalk XVI 3.4 has some compatibility  problemsH                     with CompuServe, and cannot be used as is.   There      ,                                      - 1 -        M      XMODEM on CompuServe                                      October 1984n  H                     is a patch  in  the  IBM  PC  Sig's  XA5  databaseH                     (called CISXTK.TXT) which  can  be  used  to  makeH                     Crosstalk  work  well  with  CompuServe.    FutureH                     versions  of  Crosstalk  should  work  well   with!                     CompuServe. !           See:      Section 4.1   H           Question: My <fill in the blank>  terminal  program  doesn'tH                     work with CompuServe's XMODEM, but it  works  justH                     fine with  everybody  else!  What  are  you  doing                     wrong????oH           Answer:   The XMODEM protocol was never  designed  with  theH                     idea of  communicating  over  a  packet  switchingH                     network to  large  time  sharing  computers.   TheH                     biggest problem  comes  from  the  fact  that  theH                     network introduces delays between the host and theH                     micro and that the host may not be able to respond<                     quickly to the micro's communications. H                     Most terminal programs do  work  with  CompuServe,H                     and many that do not can be patched to  work  withH                     CompuServe (e.g., Crosstalk)  by  simply  relaxing;                     the timing parameters in the program.y!           See:      Section 3.1g H           Question: Does  your  XMODEM   implementation   handle   CRC7                     checking as well as checksumming?e           Answer:   Yes.           See:      Section 2 H           Question: Where can  I  find  documentation  on  the  XMODEM                     protocol?aH           Answer:   The  closest  thing  to   an   official   documentH                     specifying the XMODEM protocol is  a  small  notesH                     file Ward Christensen wrote describing  the  basicH                     protocol.  This file can be found in many  of  the)                     SIGs on CompuServe. $           See:      Reference [1].               ,                                      - 2 -        M      XMODEM on CompuServe                                      October 1984                0.        Abstract H           CompuServe has implemented a version of the XMODEM  protocolH           that allows most XMODEM users to successfully transfer filesH           securely between their micros and CompuServe's hosts.   ThisH           implementation was not and cannot be 100%  faithful  to  theH           original XMODEM specification (see reference [1]),  and  theH           differences between micro to micro XMODEM and micro to  hostH           XMODEM has caused some people problems.  The purpose of thisH           short article is to describe, in detail, the  most  frequentH           problems people have with micro to host XMODEM, and to offer?           some suggestions on how to overcome these problems.e  &           1.        XMODEM's origins H           The XMODEM (aka MODEM7) protocol was originally  devised  byH           Ward Christensen as a  protocol  for  communicatons  betweenH           microcomputers.  As it was originally devised, the user runsH           a program called "MODEM", and  dials  up  another  computer.H           The user then instructs the remote computer to run a programH           called "XMODEM".  XMODEM  and  MODEM  then  use  the  XMODEMA           protocol to transfer files between the two computers.e H           The XMODEM protocol has several assumptions implicit in  itsH           design, and these assumptions are the source of the problemsH           people have in using XMODEM protocol on CompuServe.  Some of"           these assumptions are: A                o File lengths are exact multiples of 128 bytes. 9                o Word size is 8 bits on both computers.rG                o Data is transmitted 8 bits, no parity, one stop bit.H                o Both   computers   are   dedicated   (single    user)"                  microcomputers.H                o Both computers are talking  to  each  other  directly%                  over a phone line.A    i&          2.      The XMODEM protocol H           The XMODEM protocol is a half duplex protocol --  infomationH           travels in only one direction at once.  The  basic  protocol&           works something like this: H                1.  When the receiver is ready to start receiving data,H                    it  transmits  a  <nak>  (negative  acknowledgment)      ,                                      - 3 -        M      XMODEM on CompuServe                                      October 1984s  H                    character to the sender, and  continues  to  do  so,                    every 10 seconds until: H                2.  The sender sends a block.  Each block contains  theH                    block number (modulo 256), 128 bytes of data, and aH                    checksum.  Once the block is sent, the sender waits                    while:e H                3.  The receiver verifies that he  received  the  blockH                    correctly; if the received checksum  matches,  thenH                    the receiver sends  an  <ack>  character,  and  theH                    sender sends the next 128 bytes of the  file  (stepH                    2).  If the block was not received correctly --  orH                    if 10 seconds expires before a  complete  block  isH                    received, the receiver sends a <nak>  character  toH                    the sender.  When the sender receives a  <nak>,  it1                    re-transmits the last block. H                4.  Steps 2 & 3 are repeated until the end of the file.H                    At the end of the file, the sender sends  an  <eot>:                    character instead of a block of data. H                5.  When the receiver sees the <eot>, it sends an <ack>H                    to the  sender,  and  then  the  file  transmission)                    process is complete.r  H           There is a variant of the XMODEM  protocol  that  CompuServeH           also supports, called  the  CRC  option.   In  the  originalH           XMODEM protocol, the checksum of each  block  was  only  oneH           byte long.   This  small  of  a  checksum  (along  with  theH           algorithm used to generate it) allows errors to easily sneak2           into a supposedly error free protocol. H           The CRC option works roughly  like  this:   Instead  of  theH           receiver sending out <nak>s at the very beginning, it  sendsH           out the letter "C".  If the sender has the  CRC  option,  itH           treats this just like a <nak>,  but  knows  to  compute  theH           two-byte CCITT CRC-16 and add it to the end  of  all  blocksH           instead of the one byte checksum.  If the  sender  does  notH           have the CRC option, then the "C" character has  no  meaningH           to it and is ignored.  The receiver may try about three "C"sH           before deciding that the sender will not  handle  CRCs,  andH           then  the  receiver   transmits   a   <nak>   to   start   a*           checksum-XMODEM file transfer. 1           3.      XMODEM Problems on CompuServel       ,                                      - 4 -        M      XMODEM on CompuServe                                      October 1984   H           Because of the assumptions  made  in  the  XMODEM  protocol,H           various difficulties arise in using XMODEM over  CompuServe.4           Here are some major classes of problems: !           3.1     XMODEM Timingt H           Since  XMODEM  was  originally  devised  for  micro-to-microH           communications,  it  has  some  problems  fitting  into   anH           environment where one of  the  computers  happens  to  be  aH           mainframe and the two computers are  not  connected  over  aH           simple phone  line  but  via  a  packet  switching  network.H           CompuServe's network can often introduce long delays in whatH           should be continuous communications,  as  can  a  very  busy           host.  H           When these delays arise, the  microcomputer  running  XMODEMH           may mistake them for a breakdown in  communications.   If  aH           long delay occurs in the middle of a packet -- in the middleH           of the data --  many  XMODEM  implementations  see  that  asH           meaning there has been data lost.  These  delays  result  in#           the following symptoms:s H                o The receiver cannot  successfully  receive  even  the'                  first block of data. H                o The receiver consistently <nak>s blocks or  <nak>s  aH                  majority of blocks, although eventually receives  the                  file.H                o The receiver just suddenly gives up in the middle  of8                  a seemingly successful file transfer.H                o The receiver has great difficultly in  receiving  theH                  file, and gives up  anywhere  from  5  to  20  blocks)                  through the  transfer. H                o The file transfer proceeds very smoothly with severalH                  successfully transfered blocks when all of  a  suddenH                  every block transmitted is rejected (<nak>ed) by  the                  host.  H           Note that all of these problems are  indistinguishable  fromH           other communications problems (e.g., noisy phone lines,  badH           parity settings).  A key question  to  ask  people  who  areH           having XMODEM problems is "Have you ever successfully done aH           XMODEM transfer to CompuServe?"  If the answer is yes,  then3           the following problems may be at fault.  (           3.1.1   Delays within blocks H           The XMODEM documentation [1] recomends that a  gap  of  more      ,                                      - 5 -        M      XMODEM on CompuServe                                      October 1984   H           than 1 second be treated as a breakdown  of  communications.H           On a microcomputer, this makes sense -- there is  no  reasonH           for a dedicated micro computer to suddenly stop transmittingH           and then resume.   But on CompuServe's systems and  network,H           a  1  second  delay  is  not  only  possible,  but   happens           frequently!p H           If the microcomputer decides that this delay is a  breakdownH           of some sort, it will send a <nak> to CompuServe, requestingH           that the block be retransmitted.  Unfortunately, the rest ofH           the first block is still "in  the  pipe"  --  and  when  theH           receiver gets this block the receiver may do  anything  fromH           abort the transfer to  ignore  it.   Assuming  the  receiverH           handles the rest of the block gracefully (and  the  rest  ofH           the block doesn't look like the start of another block), theH           host will see the <nak> the receiver sent and retransmit theH           block.   If  there's  a  delay  in  the   middle   of   thatH           transmission, the receiver will <nak>  it  too,  and  so  on           forever. H           Thus, when the receiver is too sensitive to  delays  in  theH           middle of transmissions, either the receiver gives  up  veryC           quickly or the receiver <nak>s every block transmitted.r )           3.1.2   Delays between blocks  H           Fortunately, most implementations  of  the  XMODEM  protocolH           aren't that sensitive to delays in  the  middle  of  blocks.H           But other delays can cause problems too.  When  a  block  isH           received by the microcomputer, for example, the  micro  willH           almost immediately <ack> or <nak> the block and wait for theH           next block to be sent.  The XMODEM specification [1]  statesH           that if the next block does not arrive  within  10  seconds,>           the receiver should send its <ack> or <nak> again. H           Ten seconds is not a  very  long  time,  however,  when  theH           network and/or mainframe is  heavily  loaded.   Often,  whatH           will happen is that the <ack> or <nak> will  arrive  at  theH           host, the host will begin transmission of  the  next  block,H           but the block won't make it to the micro in time.  Then, theH           micro transmits a <nak>, even though the host has  correctly+           received the first <ack>/<nak>.  H           What happens, then, is that a   <nak>  enters  the  network,H           even though the host has seen and  responded  to  the  firstH           <ack> or <nak>.  After that, things can easily degrade.  TheH           host may find  itself  one  block  ahead  of  the  receiver,H           causing the receiver to give up on the spot.  The  host  may      ,                                      - 6 -        M      XMODEM on CompuServe                                      October 1984o  H           find itself stuck one <ack> or <nak>  behind  the  receiver,H           which could result in a successful, although very difficult,H           file transfer.  And the network  problems  could  be  severeH           enough -- or the micro sensitive enough --  that  the  microH           goes through about 6 or so blocks (mostly <nak>s with a  few!           <ack>s) and gives up.c (           3.1.3   Network Flow Control H           When the user is sending data to CompuServe, the  node  willH           send an XOFF (^S) character to the micro  if  the  micro  isH           transmitting faster than the node can send the data  to  theH           host.  This happens even during an XMODEM transfer (althoughH           very infrequently).  If the micro misinterprets the ^S as  aH           <nak>, it will immediately retransmit the block  --  causingH           the network to send even more ^Ses and the micro to see evenH           more naks.  Usually what happens is that  the  micro  thinksH           that every block it transmits  is  being  <nak>ed,  and  theH           micro gives up almost immediately.  This problem can  strikeH           anytime during an upload to the  host,  and  things  can  be5           proceeding very smoothly upto that point.  0           3.1.4   Timing suggestions and hints H           To overcome and avoid these  problems,  an  XMODEM  protocolH           implementation should wait 20 seconds before sending a <nak>H           on a lost block, wait at least 10 seconds during  delays  inH           the middle of a block, and honor (or at least  ignore)  flow<           control from the node during uploading of files. H           Many programs which have timing problems with CompuServe canH           be patched to relax their timing  restrictions.   A  typicalH           place to look is for calls to a "timed input" routine (whereH           the routine will only  wait  so  long  for  a  character  toH           arrive).  Either patching that routine (make it  wait  twiceH           as long, perhaps)  or  patching  the  code  that  calls  theH           routine (to use a longer time out value) would help to  make*           the XMODEM work on CompuServe. -           3.2     Host file Format Concerns  1           3.2.1   The Host file format problems  H           While almost all microcomputers  have  an  8  bit  word  (orH           multiple of 8 bits), CompuServe has a  36  bit  word.   TextH           files are stored with 7 bit bytes  (5  of  them  per  word).H           While this poses no problems for pure  text  files  (as  theH           ASCII character set is defined for only  7  bits  of  data),      *                                      - 7 M      XMODEM on CompuServe                                      October 1984l  H           "binary" files cannot be stored as is on  our  host  systemsH           (an example of binary data would be an  executable  program,H           or a WordStar file).  Files in which 8 bits of data per byteH           must be preserved -- binary files -- are stored in a special5           file format (currently Intel hex format).  H           Thus, when people upload or  download  to  CompuServe  using#           XMODEM, they are asked:t -                   Transfer types available,t )                    1 - ASCII  (7 - bit)r)                    2 - Binary (8 - bit)v ,                   Please make a selection: H           People often pick the wrong answer, the results  are  either:           an unsuccessful or useless upload or download. (           3.2.2   The correct approach H           For uploading, the choice of  a  transfer  type  can  be  asH           simple as: "If it's a text file, use ASCII.   If  it's  not,           use binary." H           For downloading, the correct transfer type is the  same  oneH           that was used to upload the file,  i.e.,  if  the  file  wasH           uploaded with an ASCII transfer it must be  downloaded  withH           an ASCII transfer; if the file was uploaded  with  a  binaryB           transfer it must be downloaded with a binary transfer. H           At the moment, it is a problem for users to determine  whichH           type the file was uploaded in.  Many SYSOPs have the  file'sH           description specify the correct  approach  for  downloading.H           Other SYSOPs enforce the convention that files with a ".BIN"H           extension should be  downloaded  with  the  binary  transferH           while other files should use the  ASCII  transfer.    It  isE           best to ask what policy is in use if there is some doubt.c H           In the future, the SIG program will be improved so that  the>           choice of which  transfer  type  won't  beuring  a           download.d &           3.2.3   What happens if... =           The user downloads a binary file with ASCII mode?  H                The user gets the Intel hex format of  the  file.   The      ,                                      - 8 -        M      XMODEM on CompuServe                                      October 1984i  H                downloaded file can be salvaged by use of a program  toH                convert Intel hex format back  to  binary.   Currently,H                the IBM Novice  forum  (PCS-129)  has  such  a  program                available.  <           The user downloads an ASCII file in binary mode? H                The user usually receives one or two blocks of  garbage                data, at best.s 9           The user uploads a binary file in ASCII mode?  H                The file transfer will not succeed, and any files  left7                over after the upload will be useless.  :           The user uploads an ASCII file in binary mode? H                The file transfer will succeed, but the  uploaded  fileH                will be encoded  into  Intel  hex  format.   Thus,  anyH                people who download the file in ASCII mode or  use  theH                Read command will receive a hex representation  of  theH                file.  People who download the  file  in  Binary  mode,E                however, will be able to receive the file correctly.a  #           4.      XMODEM and ....  2           4.1     CROSSTALK (XTALK), version 3.4 H           Crosstalk has its timing  parameters  set  too  sensitively.H           Thus, it is virutually impossible to perform transfers using=        k.  MicroStuff,  the  creators  of  Crosstalk,  haveF           provided a patch to thr software which allows it work with?           CompuServe.  This patch can be  the  IBM  PC  SIG'st)           database (see reference [2]).l                   ,                                      - 9 -        M      XMODEM on CompuServe                                      October 1984             4.2     PC-TALK IIIl H           PC-Talk will work fine with CompuServe, so long as the  userH           is running PC-Talk in 8 bits / no  partiy  mode.   The  mostH           recent version(s) of PC-Talk are set up to switch to 8  bitsH           / no parity automatically on an XMODEM transfer,  but  these:           versions are still rare in the user community.  H           By default, CompuServe communicates in 7 bits, even  parity.H           Thus, before PC-Talk can be thrown into 8  bits  no  partiy,C           the user must tell CompuServe to talk 8 bits no parity.d D           The steps involved in making this change are as follows:  H                1.  The user must log into CompuServe as usual (i.e., 7'                    bits even parity). H                2.  The user must then run the Default  program.   ThisH                    program can be reached either by typing "R  DEFALT"H                    from command mode in the personal  file  area  (the  TG                   "OK" prompt), or by typing "GO DEFALT" from any "!"                     prompt. H                3.  In Default, the user should select option #5, "ViewH                    or Change current terminal parameters."   Then,  heH                    should  select  option  #8,  "Parity  is",   changeH                    parity to ZERO, and then exit the default  program,2                    making all changes permanent. H                4.  At this point, PC-Talk can be switched into 8  bitsH                    no parity.  On some modems (but  not  most  of  theH                    Hayes line of modems), doing this switch will causeH                    the modem to hang up.  Thus, it may be advisible toH                    log off CompuServe before switching to  8  bits  no                    parity. H                5.  Once PC-Talk is  running  in  8  bit  mode,  it  isH                    possible  to  easily  upload  and  download   using                    XMODEM.   H           The next time the user dials into CompuServe (with  PC  TalkH           set to 8 bits no parity) and types control-c  to  catch  theH           system's attention, the "User ID:" prompt will  be  garbled.H           Once  the  system  recognizes  the  User  ID,  however,  the      -                                      - 10 -r        M      XMODEM on CompuServe                                      October 1984   H           password prompt will be  presented  in  clear  text.   Thus,H           users should just muddle through the garbled User ID  prompt5           and everything will work well after that.g  H           If the user's modem does not hang up when the parity settingH           is changed, it is also possible  to  change  to  8  bits  noH           parity just before performing an XMODEM transfer, and changeH           back to 7 bits even parity when it  completes.   This  is  aH           rather  involved,  manual  process,  though,  and   is   not           recomended.a H           Note: Putting PC-Talk into 8 bits  no  parity  is  necessary3           even to upload or download ASCII files.                                         -                                      - 11 -O        M      XMODEM on CompuServe                                      October 1984b  /                                    References /                                    ----------r  H           [1]  "Modem Protocol Overview" by Ward  Christensen.   FoundH                various places throughout  the  system,  including  theH                Programmer's   SIG's   XA2   database   in   the   fileH                "PROTO1.DOC".  This document is the starting point  forH                anyone  desiring  to  implement  the  XMODEM  protocol,H                although the changes  and  suggestions  presented  here(                should be kept in mind. H           [2]  Crosstalk XVI 3.4 patch.  Found in the  IBM  SIG's  XA5H                database in the file CISXTK.TXT.   This  requires  someH                sophistication on the part of the user, as it  involvesC                patching Crosstalk using the PC-DOS debug program.                                       -                                      - 12 -     