ACMCrossroads / Xrds1-1 / 

 

Book Review

Serial Communications Books


by Saveen Reddy

figure

Serial Communications in C and C++
Mark Goodwin
1992
MIS Press

figure

PC Magazine C++ Communications: Utilities
Michael Holmes and Bob Flanders
1993
Ziff-Davis Press

figure

Serial Communications: A C++ Developer's Guide
Mark Nelson
1992
M&T Books

Efficient serial communication is a tremendously interesting and challenging task with DOS PC's. DOS provides essentially useless serial port services. They are not efficient in the first place, and in the second they are meant for polled rather than interrupt-driven I/O. Add to this the always-present complications for low-level work with different hardware configurations and it isn't surprising to see that many books and magazine articles have been devoted to the topic. Here we'll examine three books that aim to teach the subject in great detail and offer useful, functional code that you can use.

As serial communications books go, you'll find they all provide in-depth coverage of the technical issues of UART programming and simple device drivers. From the very low-level aspects, each book slowly advances to the standard topics of file transfers, terminal emulation, and finishes with a simple communications program. Thus, each of the books is adequate for learning about hardware issues and device drivers. However, past the fundamentals, the books differ greatly.

Holmes and Flanders provide very readable material. Unlike the other two books, theirs teaches while simultaneously developing a fairly robust program, called PolyComm. An interesting aspect of their book is that they put a nice interface on PolyComm and also cover in great detail fax transmission and reception (a feature of PolyComm). The book includes a state diagram for XMODEM transmission and reception. While a relatively minor addition to the entire book, it's remarkably useful in helping to understand the protocol. Other books should follow this outstanding example. Unfortunately, Holmes and Flanders do not provide this state diagram for the other protocol that their program supports -- YMODEM. Nor does the book ever deal with ZMODEM. This is, I feel, a serious omission though fairly typical for these types of books.

Nelson's approach to serial communications is heavily object-oriented. A reader doesn't need to be an expert in C++ beforehand as he explains the design well. His book concentrates on generalizing the behavior of an RS232 port by making a base class for it and then deriving classes which inherit the generalized virtual behavior for specific hardware. The result is that his I/O routines can be used with a tremendous variety of hardware and software configurations -- ISA, MCA, multiport boards, FOSSIL drivers, MS Windows. If this in itself doesn't make his code some of the most useful I've ever found , then the fact that he includes the ZMODEM protocol certainly does. Strangely, he then proceeds to ignore the lowly XMODEM and YMODEM protocols. Unlike Holmes and Flanders, he doesn't aim to provide an actual communications program, rather a library of tools with which to write your own. It's a remarkable feat to explain a large and complex library as well as he does. It's even more remarkable that his code can very easily be incorporated into other programs. I used his classes in conjunction with Borland's TurboVision (1.0) to develop a DOS-GUI communications program in two days. True, it was essentially a rather attractive dumb terminal, but the ease with which it was developed has turned me into an admirer of Nelson's work.

Goodwin's represents the least useful of the three books. His style is too abrupt and technical. It was difficult to read and stay interested. His code is actually C, for which he provides additional C++ wrappers that don't seriously exploit C++ OOP features. Unlike the other two books which provide the code on disk, you are expected to pay additionally for it. This is not an immediately objectionable feature of his work, but when coupled with the fact that the other two books are more readable, more useful, more robust, I found it hard to accept.

In short, if you have an interest in DOS communications, get C++ Communications: Utilities and Serial Communications: A C++ Developer's Guide. You might not read every page or use every line of code, but you will find them to be powerful, useful tools.

Copyright 2004, The Association for Computing Machinery, Inc.