HS: A HANDSHAKING SERIAL LINE HANDLER Written by GARY PRECKSHOT UNIVERSITY OF ARIZONA TUCSON, ARIZONA October 27, 1980 INTRODUCTION ____________ A major problem in installations where a number of small computers exist is that of transfering data from one machine to another. Usually this occurs when it is desired to move program source files developed on one machine having peripherals convenient for program development to a machine less well equipped. For example, transferring programs from a hard disk machine to one having floppy disks or no disks at all. I present here a serial line handler which allows convenient file transfer between two machines running under DEC RT-11 Version 3B or later, and whose protocol is so simple that a complementary serial I/O handler may be written easily for other operating systems. THE HS: HANDLER ___ ___ _______ The HS: handler is a modular serial line handler configured for installation under RT-11 V3B which achieves block-by-block or line-by-line synchronized transmission of data across a serial data link. It does this by using a very simple handshake in which the sending end requests permission to send data before actually transmitting the data object in question. The handler operates either in data transparent block (512 bytes) mode, or in ASCII-only line mode, parity suppressed. Transmitting mode must be selected by using the SET command, while receiving mode is selected automatically by handshake. In either mode, synchronization is acheived by transmitting an endless series of ENQ characters until the receiver responds with a single ACK. Clearly this requires that the link be operated in full duplex mode. The transmitter indicates its mode in the first non-ENQ character it transmits after receiving ACK. STX indicates block mode, and any other ASCII character indicates line mode. In block mode, the next 512 bytes are considered to be data, and are terminated by the 513th byte, an ASCII ETB. There are no redundancy checks, and the block terminator represents the only check on completed transmission. The buffer size given to the handler must be an integral number of 512 byte blocks, but resynchronization occurs after each block, so that the receiver needs a minimum buffer size of one block. In line mode, transmission continues until a linefeed, control Z, or end of transmission buffer is encountered, at which point resynchronization occurs. End of buffer resynchronization is indicated to the receiver by appending an ETB character. Control Z is used to indicate an end of file. 1 2 In both modes, end of file is indicated by transmission of control Z. Since the block mode is data transparent, this is actually implemented by replacing the first non-ENQ character (STX in block mode), with control Z, which the receiver interprets as a line containing but a single control Z, indicating end of file. However, control Z may be embedded in a line in line mode, which will give rise to a receiver report of end of file. The handler is configured so that it automatically transmits a single character control Z line upon being closed, so that closing the transmitter will cause an end of file report at the receiver. USING THE HS: HANDLER _____ ___ ___ _______ Line mode of this handler was implemented for those uses that generally involve line-by-line dialogue between a program and what it believes is a teletype or terminal. It is generally unsatisfactory for use with systems programs because it will usually result in files that have only one line per block. It is very satisfactory for those uses which require immediate transmission upon a terminating character, in this case linefeed, which block oriented handlers will not do. The user should take care when using the special characters ETB, control Z, and STX, as these may lead to unintended results in line mode. Block mode of HS: was implemented so that HS: would appear to be a standard block oriented device that could be substituted by use of the RT-11 ASSIGN command for any legal device in the system. HS:DUMMYF.ILE may be used in ANY ___ position that is legal for an RT-11 standard file specification. In particular, it may be used with the RT-11 COPY command to copy a file to a link, on the other end of which is another RT-11 system using COPY and HS: to copy a file from the link. In a close-coupled short-link situation the lack of redundancy checking in HS: may be easily got around by the following command strings in the sending and receiving systems: SEND: COPY FILEN.AME HS: DIF HS:FILEN.AME FILEN.AME RECV: COPY HS:FILEN.AME SY: COPY FILEN.AME HS: 3 The DIF command will compare the retransmitted file to the original and provide an even more secure indication than partial redundancy checking, since, in fact, what we are doing is 100 % redundancy checking. CONCLUSION __________ A handshaking synchronizing handler was written that satisfies a need for local transmission of data regardless of the speed of copying devices at either end of a serial link. The fact that it is modular enables its use with standard system utilities under RT-11 V3B in block mode, and a line mode is provided for those wishing line-by-line synchronized data transmission. Because we envision its use only in a closely coupled local environment, 100 % redundancy checking for accuracy of transmission is practical. Commented copies are available from G. Preckshot.