Gift Guide

Effective TCP/IP Programming: 44 Tips to Improve Your Network Programs / Edition 1

Paperback (Print)
Used and New from Other Sellers
Used and New from Other Sellers
from $1.99
Usually ships in 1-2 business days
(Save 96%)
Other sellers (Paperback)
  • All (17) from $1.99   
  • New (8) from $40.00   
  • Used (9) from $1.99   


Programming in TCP/IP can seem deceptively simple. Nonetheless, many network programmers recognize that their applications could be much more robust. Effective TCP/IP Programming is designed to boost programmers to a higher level of competence by focusing on the protocol suite's more subtle features and techniques. It gives you the know-how you need to produce highly effective TCP/IP programs.

In forty-four concise, self-contained lessons, this book offers experience-based tips, practices, and rules of thumb for learning high-performance TCP/IP programming techniques. Moreover, it shows you how to avoid many of TCP/IP's most common trouble spots. Effective TCP/IP Programming offers valuable advice on such topics as:

  • Exploring IP addressing, subnets, and CIDR
  • Preferring the sockets interface over XTI/TLI
  • Using two TCP connections
  • Making your applications event-driven
  • Using one large write instead of multiple small writes
  • Avoiding data copying
  • Understanding what TCP reliability really means
  • Recognizing the effects of buffer sizes
  • Using tcpdump, traceroute, netstat, and ping effectively
Numerous examples demonstrate essential ideas and concepts. Skeleton code and a library of common functions allow you to write applications without having to worry about routine chores.

Through individual tips and explanations, you will acquire an overall understanding of TCP/IP's inner workings and the practical knowledge needed to put it to work. Using Effective TCP/IP Programming, you'll speed through the learning process and quickly achieve the programming capabilities of a seasoned pro.


Read More Show Less

Editorial Reviews

From Barnes & Noble
The 44 "mini-lessons" in this book will help network developers identify the key obstacles and bottlenecks that affect TCP/IP programs -- and help them arrive at "best practices" solutions. Jon Snader demystifies TCP/IP with detailed, carefully annotated C examples designed to help you maximize performance, reliability, efficiency, and maintainability.
A guide for experienced programmers to the protocol suite's more subtle features and techniques. Self-contained lessons offer tips, practices, and rules of thumb for learning high-performance TCP/IP programming techniques, and show how to avoid common problems. Numerous examples demonstrate essential concepts. Skeleton code and a library of common functions allow programmers to write applications without worrying about routine chores. Snader is a software engineer and a TCP/IP expert. Annotation c. Book News, Inc., Portland, OR (
Read More Show Less

Product Details

  • ISBN-13: 9780201615890
  • Publisher: Addison-Wesley
  • Publication date: 5/4/2000
  • Edition description: New Edition
  • Edition number: 1
  • Pages: 320
  • Product dimensions: 7.32 (w) x 9.05 (h) x 0.78 (d)

Meet the Author

Jon C. Snader is a TCP/IP and VPN expert whose background includes work in communications, networking, compiler development, operating systems, and radio network controllers.

Read More Show Less

Read an Excerpt

The explosive growth of the Internet, wireless communications, and networking in general has led to a corresponding growth in the number of programmers and engineers writing networking applications. TCP/IP programming can seem seductively simple. The Application Programming Interface (API) is straightforward, and even the newest beginner can take a template for a client or server and flesh it out to a working application.

Often, however, after an initial surge of productivity, neophytes begin to bog down in details and find that their applications suffer from performance or robustness problems. Network programming is a field full of dark corners and often misunderstood details. This book sheds light into those corners and helps replace misunderstanding with an appreciation for the often subtle points of TCP/IP programming.

After finishing this book, you should have a thorough understanding of many of the trouble spots in network programming. In the text we examine many areas that seem only peripherally connected to the core knowledge that a working network programmer is expected to have. We will see, however, that by gaining an understanding of these minutiae, we also gain an appreciation for how the inner workings of the network protocols can interact with our applications. Armed with this insight, application behavior that previously seemed bewildering becomes understandable, and the solutions to problems become clear.

The organization of the text is a little unusual. We examine common problems one at a time in a series of tips. During the process of studying a particular trouble spot, we usually explore some aspect of TCP/IP programming in depth. When we finish, we willnot only have identified and dealt with common problems, we will also have a fairly comprehensive understanding of how the TCP/IP protocols work and interact with our applications.

The organization of the text into tips leads to a certain disjointedness. To help guide you, Chapter 1 contains a road map that explains the material covered in each chapter and how it all hangs together. The Contents, which lists each tip, will give you a sense of the text's organization. Because the title of each tip is in the form of an imperative, we can also think of the Contents as a list of network programming precepts.

On the other hand, this organization into tips makes the text more useful as a handbook. When we run into a problem in our day-to-day work, it is easy to revisit the appropriate tip to refresh our understanding of that particular problem area. You will find that many topics are visited in more than one tip, sometimes from a slightly different viewpoint. This repetition helps solidify the concepts and makes them seem more natural.


This text is written primarily for the advanced beginner or intermediate network programmer, but more experienced readers should find it useful as well. Although the reader is presumed to have a familiarity with networking and the basic sockets API, Chapter 1 contains a review of the elementary socket calls and uses them to build a primitive client and server. Tip 4 (Develop and Use Application Skeletons) revisits the various client and server models in more detail, so even a reader with minimal background should be able to understand and benefit from the text.

Almost all of the examples are written in the C language, so a reasonably good understanding of elementary C programming is necessary to get the full benefit from the programs in the text. In Tip 31 (Remember That All the World's Not C) we show some examples written in Perl, but no knowledge of Perl is assumed. Similarly, there are a few examples of small shell programs, but again, no previous experience with shell programming is necessary to understand them.

The examples and text attempt to be platform neutral. The examples are, with a few exceptions, intended to compile and run under any UNIX or Win32 system. Even those programmers not working on a UNIX or Windows system should have little trouble porting the examples to work on their platforms.

Read More Show Less

Table of Contents


1. Introduction.

A Few Conventions.

Road Map to the Rest of the Book.

Client-Server Architecture.

Basic Sockets API Review.


2. Basics.

Tip 1: Understand the Difference between Connected and Connectionless Protocols.

Tip 2: Understand Subnets and CIDR.

Tip 3: Understand Private Addresses and NAT.

Tip 4: Develop and Use Application “Skeletons.”

Tip 5: Prefer the Sockets Interface to XTI/TLI.

Tip 6: Remember That TCP Is a Stream Protocol.

Tip 7: Don't Underestimate the Performance of TCP.

Tip 8: Avoid Reinventing TCP.

Tip 9: Realize That TCP Is a Reliable Protocol, Not an Infallible Protocol.

Tip 10: Remember That TCP/IP Is Not Polled.

Tip 11: Be Prepared for Rude Behavior from a Peer.

Tip 12: Don't Assume That a Successful LAN Strategy Will Scale to a WAN.

Tip 13: Learn How the Protocols Work.

Tip 14: Don't Take the OSI Seven-Layer Reference Model Too Seriously.

3. Building Effective and Robust Network Programs.

Tip 15: Understand the TCP Write Operation.

Tip 16: Understand the TCP Orderly Release Operation.

Tip 17: Consider Letting inetd Launch Your Application.

Tip 18: Consider Letting tcpmux “Assign” Your Server's Well-Known Port.

Tip 19: Consider Using Two TCP Connections.

Tip 20: Consider Making Your Applications Event Driven (1).

Tip 21: Consider Making Your Applications Event Driven (2).

Tip 22: Don't Use TIME-WAIT Assassination to Close a Connection.

Tip 23: Servers Should Set the SO_REUSEADDR Option.

Tip 24: When Possible, Use One Large Write Instead of Multiple Small Writes.

Tip 25: Understand How to Time Out a Connect Call.

Tip 26: Avoid Data Copying.

Tip 27: Zero the sockaddr_in Structure Before Use.

Tip 28: Don't Forget about Byte Sex.

Tip 29: Don't Hardcode IP Addresses or Port Numbers in Your Application.

Tip 30: Understand Connected UDP Sockets.

Tip 31: Remember That All the World's Not C.

Tip 32: Understand the Effects of Buffer Sizes.

4. Tools and Resources.

Tip 33: Become Familiar with the ping Utility.

Tip 34: Learn to Use tcpdump or a Similar Tool.

Tip 35: Learn to Use traceroute.

Tip 36: Learn to Use ttcp.

Tip 37: Learn to Use lsof.

Tip 38: Learn to Use netstat.

Tip 39: Learn to Use Your System's Call Trace Facility.

Tip 40: Build and Use a Tool to Capture ICMP Messages.

Tip 41: Read Stevens.

Tip 42: Read Code.

Tip 43: Visit the RFC Editor's Page.

Tip 44: Frequent the News Groups.

Appendix A: Miscellaneous UNIX Code.

etcp.h Header.

The daemon Function.

The signal Function.

Appendix B: Miscellaneous Windows Code.

The skel.h Header.

Windows Compatibility Routines.


Index. 0201615894T04062001

Read More Show Less



Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 3 Customer Reviews
  • Anonymous

    Posted May 12, 2006

    A Must-have for network programmers

    This is an excellent book for both beginning network programmers and as a refresher/reference for more experienced programmers. It handles socket programming from the beginning how-to's all the way to its more arcane aspects. It even adds material on troubleshooting utilities and other resources. I found the examples not very illuminating (which is why this is 4 stars and not 5), but the overall structure and the actual material presented more than made up for that. Not the easiest book to find, but well worth the search.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted October 31, 2000

    Must have for network programmers

    Programming TCP/IP sockets is not the most easy task although it sometimes could look this way. This book goes deep in the inner workings of socket programming. The writer knows what he talks about and is very precise in describing how things work and how they don't. I have read books from Comer and Stevens and this book belongs besides them. It should be on every serious network programmers shelf. (sources available on the web).

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted September 17, 2010

    No text was provided for this review.

Sort by: Showing all of 3 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)