Winsock Programmer’s FAQ
Section 8: Win32 Network Programming
by Ralph Davis
Addison-Wesley Developer’s Press, September 1996
820 pp., with source code on 3.5" disk
$46.95 list, $32.87 at Amazon.com (click to purchase)
Book reviewed 9/7/1998
This book would be a "shovelware" book, if it wasn’t so darned good. You know the kind I mean: they cover twenty loosely-related topics in as many chapters, are at least 1.5 inches thick, have at least three coauthors who apparently only met once in a bar, and always include a CD-ROM, packed with many, many megabytes of things that have only a tenuous tie to the contents of the book. They never seem to come from Addison-Wesley, though, and this book doesn’t mar that record.
In a way, this is the book that Jeffrey Richter could have written instead of the classic Programming Applications for Microsoft Windows, if he was more inclined to write about networking. Like that must-have book, Davis' tome is big and eclectic. They even cover some of the same topics: exception handling, memory management, threading, synchronization, file I/O, DLLs, etc. What in the world do those things have to do with network programming? Well, it makes more sense if you think of this book as a kind of story. It’s the story of a programmer with minimal Win32 skills who eventually becomes a master of the wild array of Microsoft networking APIs. That programmer could be you.
Another way to look at this book is as a “brain dump” (like a Unix core dump, only for humans) of a master Windows network programmer. So, it includes not only a networking tutorial, it covers all of the lower-level APIs that you will need to use the networking APIs effectively. For example, an understanding of Win32 file I/O is very helpful if you plan on using Winsock 2’s overlapped I/O mechanisms. Similarly, a knowledge of threading and synchronization is essential for writing efficient network servers.
Of all this, I think that the shining gem adorning this book’s well-earned crown is the book’s class library. Most Winsock books don’t even acknowledge C++, and those that do seem to develop relatively weak class libraries, or use the <shudder> Microsoft wrapper clases. That wasn’t good enough for Davis, who developed an extensive class library, and uses it entirely throughout his book. It is good enough for both commercial development, and as an "idea mine," from which you can extract the raw ideas you’ll need if you like to develop your own class libraries. This is a true class library, and not a CAsyncSocket-esque collection of wrappers. For example, in the File I/O chapter, Davis develops a COverlapped class, which he later uses as a parent class for his named pipes and Winsock classes.
Hidden away in the last part of the last chapter is a wonderful benchmarking program that pits synchronous Winsock, overlapped Winsock, CAsyncSocket, CSocket, UDP, named pipes, and RPC against each other. With it, you can find out which mechanism really is the fastest. Each of these methods has its advantages and disadvantages, of course, so you also have to weigh those against your particular situation, but running this little wonder on your system might well give you that last bit of information you need to decide on an appropriate architecture for your next networking project.
In addition to topics enumerated above, this book also covers mailslots, RPC, the LAN Manager API, Windows NT’s security API, the registry, and a number of other, lesser APIs. In a sense, this book is a kind of cook book, and a good, quality one at that. You’ll want to have it on hand on the theory that it will have some ideas you can use later, not because it will solve something for you right now. On the other hand, if you don’t yet know how to "cook," you’ll want to look elsewhere.
Note that the book’s release date puts it just barely after the Windows NT 4.0 release, and just barely before the Winsock 2.0 release. It seems to carry its age well, but it’s possible that there are a few minor pitfalls that I did not discover. But, like many other books I’ve reviewed here, this book hasn’t yet been replaced by something newer that is also better.
The actual Winsock coverage in this book is good and clear, but the rest of the book crowds it into a single 140-page chapter. Still, I as I hinted above, if you are just getting into serious Win32 programming and want to focus on networking, you might pick up this volume and Richter’s Programming Applications for Microsoft Windows. They would make a great core for a budding Win32 library.
There are several reviews of this book at Amazon.com.
Addison-Wesley also has a page dedicated to this book.
<< Windows Sockets Network Programming
||TCP/IP Illustrated >>|
|Updated Fri Dec 16 2022 12:23 MST||Go to my home page|