Home > Store

TCP/IP Illustrated, Volume 3: TCP for Transactions, HTTP, NNTP, and the UNIX Domain Protocols

Register your product to gain access to bonus material or receive a coupon.

TCP/IP Illustrated, Volume 3: TCP for Transactions, HTTP, NNTP, and the UNIX Domain Protocols


  • Sorry, this book is no longer in print.
Not for Sale


  • Copyright 1996
  • Dimensions: 7-3/8" x 9-1/4"
  • Pages: 360
  • Edition: 1st
  • Book
  • ISBN-10: 0-201-63495-3
  • ISBN-13: 978-0-201-63495-2

Praised by reviewers and practicing TCP/IP programmers alike, the TCP/IP Illustrated series examines the many facets of the TCP/IP protocol suite using a unique and highly-effective visual approach that describes the inner workings of TCP/IP with detail, insight, and clarity.

Volume 3 provides detailed coverage of four essential topics with which today's TCP/IP programmers and network administrators must be thoroughly familiar:

  • T/TCP (TCP for Transactions), an extension to TCP that makes client-server transactions faster, more efficient, and more reliable;

  • HTTP (Hypertext Transfer Protocol), the foundation for the rapidly expanding World Wide Web;

  • NNTP (the Network News Transfer Protocol), the basis for the Usenet news system; and

  • UNIX Domain Protocols, a set of protocols used heavily in UNIX implementations.

As in the previous two volumes, the book is filled with examples and implementation details within the 4.4BSD-Lite networking code.

The TCP/IP Illustrated series provides a complete picture of the protocol suite that drives the Internet, and gives programmers, system administrators, and serious users the information, understanding, and skills they need to remain at the forefront of networking technology.



Web Resources

Click for Web Resources related to this title.

Sample Content

Table of Contents

(Most chapters open with "Introduction" and conclude with "Summary".)



1. T/TCP Introduction.


UDP Client-Server.

TCP Client-Server.

T/TCP Client-Server.

Test Network.

Timing Example.





2. T/TCP Protocol.


New TCP Options for T/TCP.

T/TCP Implementation Variables.

State Transition Diagram.

T/TCP Extended States.


3. T/TCP Examples.


Client Reboot.

Normal T/TCP Transaction.

Server Receives Old Duplicate SYN.

Server Reboot.

Request or Reply Exceeds MSS.

Backward Compatibility.


4. T/TCP Protocol (Continued).


Client Port Numbers and TIME_WAIT State.

Purpose of the TIME_WAIT State.

TIME_WAIT State Truncation.

Avoiding the Three-Way Handshake with TAO.


5. T/TCP Implementation: Socket Layer.



sosend Function.


6. T/TCP Implementation: Routing Table.


Code Introduction.

radix_node_head Structure.

rtentry Structure.

rt_metrics Structure.

in_inithead Function.

in_addroute Function.

in_matroute Function.

in_clsroute Function.

in_rtqtimo Function.

in_rtqkill Function.


7. T/TCP Implementation: Protocol Control Blocks


in_pcbladdr Function.

in_pcbconnect Function.


8. T/TCP Implementation: TCP Overview


Code Introduction.

TCP protosw Structure.

TCP Control Block.

tcp_init Function.

tcp_slowtimo Function.


9. T/TCP Implementation: TCP Output


tcp_output Function.


10. T/TCP Implementation: TCP Functions


tcp_newtcpcb Function.

tcp_rtlookup Function.

tcp_gettaocache Function.

Retransmission Timeout Calculations.

tcp_close Function.

tcp_msssend Function.

tcp_mssrcvd Function.

tcp_dooptions Function.

tcp_reass Function.


11. T/TCP Implementation: TCP Input


Preliminary Processing.

Header Prediction.

Initiation of Passive Open.

Initiation of Active Open.

PAWS: Protection Against Wrapped Sequence Numbers.

ACK Processing.

Completion of Passive Opens and Simultaneous Opens.

ACK Processing (Continued).

FIN Processing.


12. T/TCP Implementation: TCP User Requests.



tcp_connect Function.


tcp_usrclosed Function.

tcp_sysctl Function.

T/TCP Futures.



13. HTTP: Hypertext Transfer Protocol.


Introduction to HTTP and HTML.

HTTP Protocol.

An Example.

HTTP Statistics.

Performance Problems.


14. Packets Found on an HTTP Server.


Multiple HTTP Servers.

Client SYN Interarrival Time.

RTT Measurements.

listen Backlog Queue.

Client SYN Options.

Client SYN Retransmissions.

Domain Names.

Timing Out Persist Probes.

Simulation of T/TCP Routing Table Size.

Mbuf Interaction.

TCP PCB Cache and Header Prediction.


15. NNTP: Network News Transfer Protocol.


NNTP Protocol.

A Simple News Client.

A More Sophisticated News Client.

NNTP Statistics.



16. Unix Domain Protocols: Introduction.




Coding Examples.


17. Unix Domain Protocols: Implementation.


Code Introduction.

Unix domain and protosw Structures.

Unix Domain Socket Address Structures.

Unix Domain Protocol Control Blocks.

uipc_usrreq Function.

PRU_ATTACH Request and unp_attach Function.

PRU_DETACH Request and unp_detach Function.

PRU_BIND Request and unp_bind Function.

PRU_CONNECT Request and unp_connect Function.

PRU_CONNECT2 Request and unp_connect2 Function.

socketpair System Call.

pipe System Call.


PRU_DISCONNECT Request and unp_disconnect Function.

PRU_SHUTDOWN Request and unp_shutdown Function.

PRU_ABORT Request and unp_drop Function.

Miscellaneous Requests.


18. Unix Domain Protocols: I/O and Descriptor Passing.
Appendix A. Measuring Network Times.

RTT Measurements Using Ping.

Protocol Stack Measurements.

Latency and Bandwidth.

Appendix B. Coding Applications for T/TCP.


Introduction and Organization of the Book

This book is a logical continuation of the TCP/IP Illustrated series: Stevens 1994, which we refer to as Volume 1, and Wright and Stevens 1995, which we refer to as Volume 2.

This book is divided into three parts,each covering a different topic:

TCP for transactions, commonly called T/TCP. This is an extension to TCP designed to make client-server transactions faster, more efficient, and reliable. This is done by omitting TCP's three-way handshake at the beginning of a connection and shortening the TIME_WAIT state at the end of a connection. We'll see that T/TCP can match UDP's performance for a client-server transaction and that T/TCP provides reliability and adaptability, both major improvements over UDP.

A transaction is defined to be a client request to a server, followed by the server's reply. (The term transaction does not mean a database transaction, with locking, two-phase commit, and backout.)

TCP/IP applications, specifically HTTP (the Hypertext Transfer Protocol, the foundation of the World Wide Web) and NNTP (the Network News Transfer Protocol, the basis for the Usenet news system).

The Unix domain protocols. These protocols are provided by all Unix TCP/IP implementations and on many non-Unix implementations. They provide a form of interprocess communication (IPC) and use the same sockets interface used with TCP/IP. When the client and server are on the same host, the Unix domain protocols are often twice as fast as TCP/IP.

Part 1, the presentation of T/TCP, is in two pieces. Chapters 1-4 describe the protocol and provide numerous examples of how it works. This material is a major expansion of the brief presentation of T/TCP in Section 24.7 of Volume 1. The second piece, Chapters 5-12, describes the actual implementation of T/TCP within the 4.4BSD-Lite networking code (i.e., the code presented in Volume 2). Since the first T/TCP implementation was not released until September 1994, about one year after Volume 1 was published and right as Volume 2 was being completed, the detailed presentation of T/TCP, with examples and all the implementation details, had to wait for another volume in the series.

Part 2, the HTTP and NNTP applications, are a continuation of the TCP/IP applications presented in Chapters 25-30 of Volume 1. In the two years since Volume 1 was published, the popularity of HTTP has grown enormously, as the Internet has exploded, and the use of NNTP has been growing about 75% per year for more than 10 years. HTTP is also a wonderful candidate for T/TCP, given its typical use of TCP: short connections with small amounts of data transferred, where the total time is often dominated by the connection setup and teardown. The heavy use of HTTP (and therefore TCP) on a busy Web server by thousands of different and varied clients also provides a unique opportunity to examine the actual packets at the server (Chapter 14) and look at many features of TCP/IP that were presented in Volumes 1 and 2.

The Unix domain protocols in Part 3 were originally considered for Volume 2 but omitted when its size reached 1200 pages. While it may seem odd to cover protocols other than TCP/IP in a series titled TCP/IP Illustrated, the Unix domain protocols were implemented almost 15 years ago in 4.2BSD alongside the first implementation of BSD TCP/IP. They are used heavily today in any Berkeley-derived kernel, but their use is typically "under the covers," and most users are unaware of their presence. Besides being the foundation for Unix pipes on a Berkeley-derived kernel, another heavy user is the X Window System, when the client and server are on the same host (i.e., on typical workstations). Unix domain sockets are also used to pass descriptors between processes, a powerful technique for interprocess communication. Since the sockets API (application program interface) used with the Unix domain protocols is nearly identical to the sockets API used with TCP/IP, the Unix domain protocols provide an easy way to enhance the performance of local applications with minimal code changes.

Each of the three parts can be read by itself.


As with the previous two volumes in the series, this volume is intended for anyone wishing to understand how the TCP/IP protocols operate: programmers writing network applications, system administrators responsible for maintaining computer systems and networks utilizing TCP/IP, and users who deal with TCP/IP applications on a daily basis.

Parts 1 and 2 assume a basic understanding of how the TCP/IP protocols work. Readers unfamiliar with TCP/IP should consult the first volume in this series, Stevens 1994, for a thorough description of the TCP/IP protocol suite. The first half of Part 1 (Chapters 1-4, the concepts behind T/TCP along with examples) can be read independent of Volume 2, but the remainder of Part 1 (Chapters 5-12, the implementation of T/TCP) assumes familiarity with the 4.4BSD-Lite networking code, as provided with Volume 2.Many forward and backward references are provided throughout the text, to both topics within this text, and to relevant sections of Volumes 1 and 2 for readers interested in more details. A thorough index is provided, and a list of all the acronyms used throughout the text, along with the compound term for the acronym, appears on the inside front covers. The inside back covers contain an alphabetical cross-reference of all the structures, functions, and macros described in the book and the starting page number of the description. This cross-reference also refers to definitions in Volume 2, when that object is referenced from the code in this volume.

Source Code Copyright

All the source code in this book that is taken from the 4.4BSD-Lite release contains the following copyright notice:

The routing table code in Chapter 6 contains the following copyright notice:


First and foremost I thank my family, Sally, Bill, Ellen, and David, who have endured another book along with all my traveling during the past year. This time, however, it really is a "small" book.

I thank the technical reviewers who read the manuscript and provided important feedback on a tight timetable: Sami Boulos, Alan Cox, Tony DeSimone, Pete Haverlock, Chris Heigham, Mukesh Kacker, Brian Kernighan, Art Mellor, Jeff Mogul, Marianne Mueller, Andras Olah, Craig Partridge, Vern Paxson, Keith Sklower, Ian Lance Taylor, and Gary Wright. A special thanks to the consulting editor, Brian Kernighan, for his rapid, thorough, and helpful reviews throughout the course of the book, and for his continued encouragement and support.

Special thanks are also due Vern Paxson and Andras Olah for their incredibly detailed reviews of the entire manuscript, finding many errors and providing valuable technical suggestions. My thanks also to Vern Paxson for making available his software for analyzing Tcpdump traces, and to Andras Olah for his help with T/TCP over the past year. My thanks also to Bob Braden, the designer of T/TCP, who provided the reference source code implementation on which Part 1 of this book is based.

Others helped in significant ways. Gary Wright and Jim Hogue provided the system on which the data for Chapter 14 was collected. Doug Schmidt provided a copy of the public domain TTCP program that uses Unix domain sockets, for the timing measurements in Chapter 16. Craig Partridge provided a copy of the RDP source code to examine. Mike Karels answered lots of questions.

My thanks once again to the National Optical Astronomy Observatories (NOAO), Sidney Wolff, Richard Wolff, and Steve Grandi, for providing access to their networks and hosts.

Finally, my thanks to all the staff at Addison-Wesley, who have helped over the past years, especially my editor John Wait.

As usual, camera-ready copy of the book was produced by the author, a Troff die-hard, using the Groff package written by James Clark. I welcome electronic mail from any readers with comments, suggestions, or bug fixes.

W. Richard Stevens
Tucson, Arizona
November 1995




Click below for Errata related to this title:

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020