UNIX Network Programming: The Sockets Networking API, Vol. 1

Hardcover
from $0.00

Author: W. Richard Stevens

ISBN-10: 0131411551

ISBN-13: 9780131411555

Category: Operating Systems - Computer Networks

UNIX Network Programming, Volume 1: The Sockets Networking API, Third Edition\ "Everyone will want this book because it provides a great mix of practical experience, historical perspective, and a depth of understanding that only comes from being intimately involved in the field. I've already enjoyed and learned from reading this book, and surely you will too."\ --Sam Leffler\ The classic guide to UNIX networking APIs... now completely updated!\ To build today's highly distributed, networked...

Search in google:

UNIX Network Programming, Volume 1: The Sockets Networking API, Third Edition"Everyone will want this book because it provides a great mix of practical experience, historical perspective, and a depth of understanding that only comes from being intimately involved in the field. I've already enjoyed and learned from reading this book, and surely you will too."—Sam LefflerThe classic guide to UNIX networking APIs... now completely updated!To build today's highly distributed, networked applications and services, you need deep mastery of sockets and other key networking APIs. One book delivers comprehensive, start-to-finish guidance for building robust, high-performance networked systems in any environment: UNIX Network Programming, Volume 1, Third Edition. Building on the legendary work of W. Richard Stevens, this edition has been fully updated by two leading network programming experts to address today's most crucial standards, implementations, and techniques. New topics include: POSIX Single UNIX Specification Version 3 IPv6 APIs (including updated guidance on IPv6/IPv4 interoperability) The new SCTP transport protocol IPsec-based Key Management Sockets FreeBSD 4.8/5.1, Red Hat Linux 9.x, Solaris 9, AIX 5.x, HP-UX, and Mac OS X implementations New network program debugging techniques Source Specific Multicast API, the key enabler for widespread IP multicast deployment The authors also update and extend Stevens' definitive coverage of these crucial UNIX networking standards and techniques: TCP and UDP transport Sockets:elementary, advanced, routed, and raw I/O: multiplexing, advanced functions, nonblocking, and signal-driven Daemons and inetd UNIX domain protocols ioctl operations Broadcasting and multicasting Threads Streams Design: TCP iterative, concurrent, preforked, and prethreaded serversSince 1990, network programmers have turned to one source for the insights and techniques they need: W. Richard Stevens' UNIX Network Programming. Now, there's an edition specifically designed for today's challenges—and tomorrow's. Booknews Tutorial on networking for those with a working knowledge of C and the UNIX system. Includes full descriptions for popular protocols such as TCP/IP, XNS, SNA, NetBIOS, OSI, and UUCP. Also includes case studies of real network applications, as well as approximately 15,000 lines of C source code, taken directly from their source files. Annotation c. Book News, Inc., Portland, OR (booknews.com)

PrefaceIntroduction\ This book is for people who want to write programs that communicate with each otherusing an application program interface (API) known as sockets. Some readers may bevery familiar with sockets already, as that model has become synonymous with networkprogramming. Others may need an introduction to sockets from the ground up. Thegoal of this book is to offer guidance on network programming for beginners as well asprofessionals, for those developing new network-aware applications as well as thosemaintaining existing code, and for people who simply want to understand how the networkingcomponents of their system function.\ All the examples in this text are actual, runnable code tested on Unix systems.However, many non-Unix systems support the sockets API and the examples arelargely operating system-independent, as are the general concepts we present. Virtuallyevery operating system (OS) provides numerous network-aware applications such asWeb browsers, email clients, and file-sharing servers. We discuss the usual partitioningof these applications into client and server and write our own small examples of thesemany times throughout the text.\ Presenting this material in a Unix-oriented fashion has the natural side effect of providingbackground on Unix itself, and on TCP/IP as well. Where more extensive backgroundmay be interesting, we refer the reader to other texts. Four texts are so commonlymentioned in this book that we've assigned them the following abbreviations:\ \ \ \ APUE: Advanced Programming in the UNIX Environment Stevens 1992\ TCPv1: TCP/IP Illustrated, Volume 1 Stevens 1994\ TCPv2:TCP/IP Illustrated, Volume 2 Wright and Stevens 1995\ TCPv3: TCP/IP Illustrated, Volume 3 Stevens 1996\ \ TCPv2 contains a high level of detail very closely related to the material in this book, asit describes and presents the actual 4.4BSD implementation of the network programmingfunctions for the sockets API (socket, bind, connect, and so on). If one understandsthe implementation of a feature, the use of that feature in an application makesmore sense.Changes from the Second Edition\ Sockets have been around, more or less in their current form, since the 1980s, and it is atribute to their initial design that they have continued to be the network API of choice.Therefore, it may come as a surprise to learn that quite a bit has changed since the secondedition of this book was published in 1998. The changes we've made to the text aresummarized as follows:\ \ This new edition contains updated information on IPv6, which was only in draft form at the time of publication of the second edition and has evolved somewhat.\ The descriptions of functions and the examples have all been updated to reflect the most recent POSIX specification (POSIX 1003.1-2001), also known as the Single Unix Specification Version 3.\ The coverage of the X/Open Transport Interface (XTI) has been dropped. That API has fallen out of common use and even the most recent POSIX specification does not bother to cover it.\ The coverage of TCP for transactions (T/TCP) has been dropped.\ Three chapters have been added to describe a relatively new transport protocol, SCTP. This reliable, message-oriented protocol provides multiple streams between endpoints and transport-level support for multihoming. It was originally designed for transport of telephony signaling across the Internet, but provides some features that many applications could take advantage of.\ A chapter has been added on key management sockets, which may be used with Internet Protocol Security (IPsec) and other network security services.\ The machines used, as well as the versions of their variants of Unix, have all been updated, and the examples have been updated to reflect how these machines behave. In many cases, examples were updated because OS vendors fixed bugs or added features, but as one might expect, we've discovered the occasional new bug here and there. The machines used for testing the examples in this book were:\ \ \ Apple Power PC running MacOS/X 10.2.6\ HP PA-RISC running HP-UX 11i\ IBM Power PC running AIX 5.1\ Intel x86 running FreeBSD 4.8\ Intel x86 running Linux 2.4.7\ Sun SPARC running FreeBSD 5.1\ Sun SPARC running Solaris 9\ \ See Figure 1.16 for details on how these machines were used.\ Volume 2 of this UNIX Network Programming series, subtitled Interprocess Communications,builds on the material presented here to cover message passing, synchronization,shared memory, and remote procedure calls.Using This Book\ This text can be used as either a tutorial on network programming or as a reference forexperienced programmers. When used as a tutorial or for an introductory class on networkprogramming, the emphasis should be on Part 2, ''Elementary Sockets'' (Chapters3 through 11), followed by whatever additional topics are of interest. Part 2 covers thebasic socket functions for both TCP and UDP, along with SCTP, I/O multiplexing,socket options, and basic name and address conversions. Chapter 1 should be read byall readers, especially Section 1.4, which describes some wrapper functions usedthroughout the text. Chapter 2 and perhaps Appendix A should be referred to as necessary,depending on the reader 's background. Most of the chapters in Part 3, ''AdvancedSockets,'' can be read independently of the others in that part of the book.\ To aid in the use of this book as a reference, a thorough index is provided, alongwith summaries on the end papers of where to find detailed descriptions of all the functionsand structures. To help those reading topics in a random order, numerous referencesto related topics are provided throughout the text.Source Code and Errata Availability\ The source code for all the examples that appear in the book is available on the Web atwww.unpbook.com. The best way to learn network programming is to take these programs,modify them, and enhance them. Actually writing code of this form is the onlyway to reinforce the concepts and techniques. Numerous exercises are also provided atthe end of each chapter, and most answers are provided in Appendix E.\ A current errata for the book is also available from the same Web site.\ The authors welcome electronic mail from any readers with comments, suggestions,or bug fixes.\ Bill Fenner\ Woodside, California\ Andrew M. Rudoff\ Boulder, Colorado\ October 2003\ authors@unpbook.com\ http://www.unpbook.com

ForewordxviiPrefacexixPart 1.Introduction and TCP/IP1Chapter 1.Introduction3Chapter 2.The Transport Layer: TCP, UDP, and SCTP31Part 2.Elementary Sockets65Chapter 3.Sockets Introduction67Chapter 4.Elementary TCP Sockets95Chapter 5.TCP Client/Server Example121Chapter 6.I/O Multiplexing: The select and poll Functions153Chapter 7.Socket Options191Chapter 8.Elementary UDP Sockets239Chapter 9.Elementary SCTP Sockets267Chapter 10.SCTP Client/Server Example287Chapter 11.Name and Address Conversions303Part 3.Advanced Sockets351Chapter 12.IPv4 and IPv6 Interoperability353Chapter 13.Daemon Processes and the inetd Superserver363Chapter 14.Advanced I/O Functions381Chapter 15.Unix Domain Protocols411Chapter 16.Nonblocking I/O435Chapter 17.ioctl Operations465Chapter 18.Routing Sockets485Chapter 19.Key Management Sockets511Chapter 20.Broadcasting529Chapter 21.Multicasting549Chapter 22.Advanced UDP Sockets587Chapter 23.Advanced SCTP Sockets621Chapter 24.Out-of-Band Data645Chapter 25.Signal-Driven I/O663Chapter 26.Threads675Chapter 27.IP Options709Chapter 28.Raw Sockets735Chapter 29.Datalink Access787Chapter 30.Client/Server Design Alternatives817Chapter 31.Streams851Appendix A.IPv4, IPv6, ICMPv4, and ICMPv6869A.1Introduction869A.2IPv4 Header869A.3IPv6 Header871A.4IPv4 Addresses874A.5IPv6 Addresses877A.6Internet Control Message Protocols (ICMPv4 and ICMPv6)882Appendix B.Virtual Networks885B.1Introduction885B.2The MBone885B.3The 6bone887B.4IPv6 Transition: 6to4889Appendix C.Debugging Techniques891C.1System Call Tracing891C.2Standard Internet Services893C.3sock Program893C.4Small Test Programs896C.5tcpdum Program896C.6netstat Program896C.7lsof Program897Appendix D.Miscellaneous Source Code899D.1unp.h Header899D.2config.h Header904D.3Standard Error Functions910Appendix E.Solutions to Selected Exercises913Bibliography947Index955

\ From Barnes & NobleThe Barnes & Noble Review\ For generations, one name’s been synonymous with UNIX networking: W. Richard Stevens. Tragically, Stevens passed away in 1999. He’s missed by UNIX professionals worldwide. But, miraculously, his work lives on. \ In UNIX Network Programming, Volume 1, Third Edition, Bill Fenner and Andrew Rudoff have worked hard to update Stevens’ guide to Sockets, while matching his legendary clarity, detail, readability, and runnable code. They’ve succeeded.\ Now there’s a “Stevens” that covers the official IPv6 standard, the latest Posix specs, SCTP, key management sockets, and current systems (from Mac OS X and Solaris 9 to Linux on Intel). This one will be a classic, too. Bill Camarda\ Bill Camarda is a consultant, writer, and web/multimedia content developer. His 15 books include Special Edition Using Word 2003 and Upgrading & Fixing Networks for Dummies, Second Edition.\ \ \ \ \ \ BooknewsTutorial on networking for those with a working knowledge of C and the UNIX system. Includes full descriptions for popular protocols such as TCP/IP, XNS, SNA, NetBIOS, OSI, and UUCP. Also includes case studies of real network applications, as well as approximately 15,000 lines of C source code, taken directly from their source files. Annotation c. Book News, Inc., Portland, OR (booknews.com)\ \