Book Review - The Internet Protocol Journal - Volume 8, Number 1

Unix Network Programming

Unix Network Programming, 3rd Edition
, by W. Richard Stevens, Bill Fenner, Andrew M. Rudoff, ISBN 0131411551, Addison-Wesley Professional, 2003.

It would be difficult to put value on a book that has been a classic text and a reference in academia and in the real world in the context of network programming for over a decade. Richard Stevens published the ever-popular
Unix Network Programming
(UNP) back in 1990, and the second edition followed in 1998. With a dedication to the memory of R. Stevens, the UNP book found itself two new authors, Bill Fenner and Andrew M. Rudoff, who would write the third edition of this book. The third edition has many updates, a new look and feel and many of new chapters that cover the topics more applicable these days. In my opinion, it is still the most valuable and profound text in the context of network programming.

Changes and Updates

For those of us who have the first two editions of this book, the third edition has the following changes:

IPv6 updates. In the second version of the book, IPv6 was merely a draft, and the sections covering IPv6 have been updated to reflect these changes.
POSIX updates. The functions/APIs and examples have been updated to reflect the changes to the latest version of the POSIX specification (1003.1-2001).
SCTP coverage. Three new chapters that cover this new reliable, message-based transport protocol have been added.
Key Management Sockets coverage. Network security and its applicability and use with IPsec are covered.
The Operating Systems and machines that are used for the examples have been updated.
Some topics such as Transaction TCP and X/Open Transport Interface have been dropped.

Many topics and sections have been updated with the authors' comments. These comments even though simple for someone new to the profession, are extremely useful because they are like hints and tips from one developer to the next to help you in your next programming assignment.

Unix Focus

If this is the only edition of the book that you will read, you are in for a treat. Topics in Network Programming are covered in detail, using concrete programming examples that all of us can relate to—all Unix, but what else is there?!

All kidding aside, the topics are covered well enough that they are useful information under any operating system. The concepts don't change; sockets are sockets under any operating system. The function call is different, but one needs to go through the same steps under any environment.

Being the most popular networking protocol, TCP/IP is covered in Part I of the book. You need to have prior understanding of the TCP/IP protocol and the OSI model, however. If this is the first time you are looking at the programming aspects of networking protocols, Part I of this book covers the basics. It begins with a couple of simple examples such as such as daytime client and a daytime server and it builds on that. TCP, UDP, and SCTP (
Stream Control Transmission Protocol
) are covered in brief in Part I, and basic concepts such as the three-way handshake of TCP and the four-way handshake of SCTP are depicted.

Part II of the book covers
and socket programming. Topics such as the socket Address Structure in IPv4 and IPv6 for TCP, UDP and SCTP are covered and examples (the same daytime client/server) are given to convey the point. It is important to mention here that all the topics and concepts are depicted for the three transport protocols: TCP, UDP and SCTP. Every socket API under the Unix programming environment is covered and examples are given for each function call to show the reader how the function can be utilized. Much attention is dedicated to Socket Options and how they are used or can be used for best results. Hints are given throughout the chapter about the pitfalls and best practices of each option.

After the basics are been covered, various I/O models are depicted in detail and examples are shown to convey the advantages and disadvantages of each I/O model. The five I/O models used through the book (and available under the Unix environment) follow:

Blocking I/O
Non-blocking I/O
I/O Multiplexing (using select and poll)
Signal driven I/O
Asynchronous I/O

Stream Control Transmission Protocol
(SCTP), a new IETF standard is also covered in detail—from the basics to the advanced. The two interface models of SCTP (one-to-one and one-to-many) are covered in detail, and their differences with TCP are also explained in full. The client/server example used throughout the book is ported to use the new SCTP protocol. The authors then explain in detail the problems that SCTP solves over TCP and where and how it would be useful to use SCTP.

Advanced topics such as IPv4 and IPv6 portability, Unix Domain Protocols, Multicasting and advanced Socket programming for UDP, TCP and SCTP cover the rest of the chapters in this book.

Various options for interoperability between IPv4 and IPv6 are discussed in the last section of the book. Advanced I/O functions bring us a new perspective of how complicated Network Programming can become. Benefits and examples of nonblocking I/O are covered in detail—the authors give examples to show us how, with very few modifications, the performance of a socket application can improve dramatically. Various methods on how to control socket operations are discussed including the use of an alarm along with SIGALRM, the use of select and various timeout options that are available in the API.

The chapters that discuss Multicasting and adding reliability to UDP are my favorite chapters in this book. The Time Server used throughout the book is re-coded to become a multicast application. Some issues that arise when designing multicast applications such as multicast on a WAN are also discussed.

As Good as Ever

The third edition of
Unix Network Programming
is as good as ever. The updates truly reflect solutions to today's challenges in network programming. Bill Fenner and Andrew Rudoff did an amazing job continuing the work of a true legend in the field of Computer Science.

—Art Sedighi

Read Any Good Books Lately?

Then why not share your thoughts with the readers of IPJ? We accept reviews of new titles, as well as some of the "networking classics." In some cases, we may be able to get a publisher to send you a book for review if you don't have access to it. Contact us at
for more information.