gogogo
Syndetics cover image
Image from Syndetics

Internetworking with TCP/IP. Volume 3: Client-server programming and applications Linux/POSIX Sockets Version. / Douglas E. Comer and David L. Stevens.

By: Contributor(s): Material type: TextTextPublication details: Upper Saddle River, N.J. : Prentice Hall, 2001.Edition: Linus/POSIX sockets versionDescription: xxvii, 601 p. ; 23 cmISBN:
  • 0130320714
Other title:
  • Client-server programming and applications
Subject(s): DDC classification:
  • 004.62 COM
Holdings
Item type Current library Call number Status Date due Barcode
Standard Loan Thurles Library Main Collection 004.62 COM (Browse shelf(Opens below)) Available 30026000067370

Enhanced descriptions from Syndetics:

Internetworking with TCP/IP, Volume III describes the fundamental concepts of client-server computing used to build all distributed computing systems, and presents an in-depth guide to the Posix sockets standard utilized by Linux and other operating systems. Dr. Douglas E. Comer compares leading server designs, and describes the key tools and techniques used to build clients and servers, including Remote Procedure Call (RPC). The book contains examples of running programs that illustrate each approach. Comer introduces the client-server model and its software design implications; the role of concurrent processing and threads; the Socket API, and differences that impact Linux programmers. Understand the key algorithms and issues associated with client and server software design; then review three leading approaches: iterative, connectionless servers (UPD); and both iterative and concurrent connection-oriented servers (TCP). The book contains extensive coverage of threading, including a new chapter on using threads for concurrency; as well as coverage of single-threaded and multi-threaded concurrent servers. Comer introduces multi-protocol and multi-service services; reviews client concurrency; tunneling at the transport and application levels; and external data representation (XDR). He reviews RPC, distributed program generation, NFS concepts and protocol; Telnet; streaming media transport; and finally, techniques for avoiding deadlock and starvation in client-server systems. For everyone who wants to master TCP/IP and understand how the Internet works.

Includes bibliographical references (p. 577-583) and index.

Table of contents provided by Syndetics

  • Foreword (p. xxiii)
  • Preface (p. xxv)
  • Chapter 1 Introduction And Overview (p. 1)
  • 1.1 Internet Applications Using TCP/IP (p. 1)
  • 1.2 Designing Applications For A Distributed Environment (p. 1)
  • 1.3 Standard And Nonstandard Application Protocols (p. 2)
  • 1.4 An Example Of Standard Application Protocol Use (p. 2)
  • 1.5 An Example TELNET Connection (p. 3)
  • 1.6 Using TELNET To Access An Alternative Service (p. 4)
  • 1.7 Application Protocols And Software Flexibility (p. 5)
  • 1.8 Viewing Services From The Provider's Perspective (p. 6)
  • 1.9 The Remainder Of This Text (p. 6)
  • 1.10 Summary (p. 7)
  • Chapter 2 The Client Server Model And Software Design (p. 9)
  • 2.1 Introduction (p. 9)
  • 2.2 Motivation (p. 10)
  • 2.3 Terminology And Concepts (p. 10)
  • 2.4 Summary (p. 20)
  • Chapter 3 Concurrent Processing In Client-Server Software (p. 23)
  • 3.1 Introduction (p. 23)
  • 3.2 Concurrency In Networks (p. 23)
  • 3.3 Concurrency In Servers (p. 25)
  • 3.4 Terminology And Concepts (p. 26)
  • 3.5 An Example Of Concurrent Process Creation (p. 29)
  • 3.6 Executing New Code (p. 34)
  • 3.7 Context Switching And Protocol Software Design (p. 34)
  • 3.8 Concurrency And Asynchronous I/O (p. 35)
  • 3.9 Summary (p. 36)
  • Chapter 4 Application Interface To Protocols (p. 39)
  • 4.1 Introduction (p. 39)
  • 4.2 Loosely Specified Protocol Software Interface (p. 39)
  • 4.3 Interface Functionality (p. 40)
  • 4.4 Conceptual Interface Specification (p. 41)
  • 4.5 System Calls (p. 42)
  • 4.6 Two Basic Approaches To Network Communication (p. 43)
  • 4.7 The Basic I/O Functions Available In Linux (p. 43)
  • 4.8 Using Linux I/O With TCP/IP (p. 45)
  • 4.9 Summary (p. 45)
  • Chapter 5 The Socket API (p. 47)
  • 5.1 Introduction (p. 47)
  • 5.2 Berkeley Sockets (p. 47)
  • 5.3 Specifying A Protocol Interface (p. 48)
  • 5.4 The Socket Abstraction (p. 49)
  • 5.5 Specifying An Endpoint Address (p. 52)
  • 5.6 A Generic Address Structure (p. 52)
  • 5.7 Major System Calls In The Socket API (p. 54)
  • 5.8 Utility Routines For Integer Conversion (p. 58)
  • 5.9 Using Socket Calls In A Program (p. 58)
  • 5.10 Symbolic Constants For Socket Call Parameters (p. 59)
  • 5.11 Summary (p. 60)
  • Chapter 6 Algorithms And Issues In Client Software Design (p. 63)
  • 6.1 Introduction (p. 63)
  • 6.2 Learning Algorithms Instead Of Details (p. 63)
  • 6.3 Client Architecture (p. 64)
  • 6.4 Identifying The Location Of A Server (p. 64)
  • 6.5 Parsing An Address Argument (p. 66)
  • 6.6 Looking Up A Domain Name (p. 67)
  • 6.7 Looking Up A Well-Known Port By Name (p. 68)
  • 6.8 Port Numbers And Network Byte Order (p. 68)
  • 6.9 Looking Up A Protocol By Name (p. 69)
  • 6.10 The TCP Client Algorithm (p. 69)
  • 6.11 Allocating A Socket (p. 70)
  • 6.12 Choosing A Local Protocol Port Number (p. 71)
  • 6.13 A Fundamental Problem In Choosing A Local IP Address (p. 71)
  • 6.14 Connecting A TCP Socket To A Server (p. 72)
  • 6.15 Communicating With The Server Using TCP (p. 72)
  • 6.16 Receiving A Response From A TCP Connection (p. 73)
  • 6.17 Closing A TCP Connection (p. 74)
  • 6.18 Programming A UDP Client (p. 75)
  • 6.19 Connected And Unconnected UDP Sockets (p. 76)
  • 6.20 Using Connect With UDP (p. 76)
  • 6.21 Communicating With A Server Using UDP (p. 76)
  • 6.22 Closing A Socket That Uses UDP (p. 77)
  • 6.23 Partial Close For UDP (p. 77)
  • 6.24 A Warning About UDP Unreliability (p. 77)
  • 6.25 Summary (p. 77)
  • Chapter 7 Example Client Software (p. 81)
  • 7.1 Introduction (p. 81)
  • 7.2 The Importance Of Small Examples (p. 81)
  • 7.3 Hiding Details (p. 82)
  • 7.4 An Example Procedure Library For Client Programs (p. 82)
  • 7.5 Implementation Of ConnectTCP (p. 83)
  • 7.6 Implementation Of ConnectUDP (p. 84)
  • 7.7 A Procedure That Forms Connections (p. 85)
  • 7.8 Using The Example Library (p. 88)
  • 7.9 The DAYTIME Service (p. 88)
  • 7.10 Implementation Of A TCP Client For DAYTIME (p. 89)
  • 7.11 Reading From A TCP Connection (p. 90)
  • 7.12 The TIME Service (p. 91)
  • 7.13 Accessing The TIME Service (p. 91)
  • 7.14 Accurate Times And Network Delays (p. 92)
  • 7.15 A UDP Client For The TIME Service (p. 92)
  • 7.16 The ECHO Service (p. 94)
  • 7.17 A TCP Client For The ECHO Service (p. 94)
  • 7.18 A UDP Client For The ECHO Service (p. 96)
  • 7.19 Summary (p. 98)
  • Chapter 8 Algorithms And Issues In Server Software Design (p. 101)
  • 8.1 Introduction (p. 101)
  • 8.2 The Conceptual Server Algorithm (p. 101)
  • 8.3 Concurrent Vs. Iterative Servers (p. 102)
  • 8.4 Connection-Oriented Vs. Connectionless Access (p. 102)
  • 8.5 Transport Protocol Semantics (p. 103)
  • 8.6 Choice Of Transport (p. 104)
  • 8.7 Connection-Oriented Servers (p. 104)
  • 8.8 Connectionless Servers (p. 105)
  • 8.9 Failure, Reliability, And Statelessness (p. 106)
  • 8.10 Optimizing Stateless Servers (p. 106)
  • 8.11 Four Basic Types Of Servers (p. 109)
  • 8.12 Request Processing Time (p. 109)
  • 8.13 Iterative Server Algorithms (p. 110)
  • 8.14 An Iterative, Connection-Oriented Server Algorithm (p. 110)
  • 8.15 Binding To A Well-Known Address Using INADDR_ANY (p. 111)
  • 8.16 Placing The Socket In Passive Mode (p. 112)
  • 8.17 Accepting Connections And Using Them (p. 112)
  • 8.18 An Iterative, Connectionless Server Algorithm (p. 112)
  • 8.19 Forming A Reply Address In A Connectionless Server (p. 113)
  • 8.20 Concurrent Server Algorithms (p. 114)
  • 8.21 Master And Slaves (p. 114)
  • 8.22 A Concurrent, Connectionless Server Algorithm (p. 115)
  • 8.23 A Concurrent, Connection-Oriented Server Algorithm (p. 116)
  • 8.24 Implementations Of Server Concurrency (p. 117)
  • 8.25 Using Separate Programs As Slaves (p. 118)
  • 8.26 Apparent Concurrency Using A Single Thread (p. 118)
  • 8.27 When To Use Each Server Type (p. 119)
  • 8.28 A Summary of Server Types (p. 120)
  • 8.29 The Important Problem Of Server Deadlock (p. 121)
  • 8.30 Alternative Implementations (p. 122)
  • 8.31 Summary (p. 122)
  • Chapter 9 Iterative, Connectionless Servers (UDP) (p. 125)
  • 9.1 Introduction (p. 125)
  • 9.2 Creating A Passive Socket (p. 125)
  • 9.3 Process Structure (p. 129)
  • 9.4 An Example TIME Server (p. 130)
  • 9.5 Summary (p. 132)
  • Chapter 10 Iterative, Connection-Oriented Servers (TCP) (p. 135)
  • 10.1 Introduction (p. 135)
  • 10.2 Allocating A Passive TCP Socket (p. 135)
  • 10.3 A Server For The DAYTIME Service (p. 136)
  • 10.4 Process Structure (p. 136)
  • 10.5 An Example DAYTIME Server (p. 137)
  • 10.6 Closing Connections (p. 140)
  • 10.7 Connection Termination And Server Vulnerability (p. 140)
  • 10.8 Summary (p. 141)
  • Chapter 11 Concurrent, Connection-Oriented Servers (TCP) (p. 143)
  • 11.1 Introduction (p. 143)
  • 11.2 ECHO Service (p. 143)
  • 11.3 Iterative Vs. Concurrent Implementations (p. 144)
  • 11.4 Process Structure (p. 144)
  • 11.5 An Example Concurrent ECHO Server (p. 145)
  • 11.6 Cleaning Up Errant Processes (p. 149)
  • 11.7 Summary (p. 150)
  • Chapter 12 Using Threads For Concurrency (TCP) (p. 151)
  • 12.1 Introduction (p. 151)
  • 12.2 Overview Of Linux Threads (p. 151)
  • 12.3 Advantages Of Threads (p. 152)
  • 12.4 Disadvantages Of Threads (p. 153)
  • 12.5 Descriptors, Delay, And Exit (p. 153)
  • 12.6 Thread Exit (p. 154)
  • 12.7 Thread Coordination And Synchronization (p. 154)
  • 12.8 An Example Server Using Threads (p. 156)
  • 12.9 Monitor And Control (p. 160)
  • 12.10 Summary (p. 161)
  • Chapter 13 Single-Thread, Concurrent Servers (TCP) (p. 163)
  • 13.1 Introduction (p. 163)
  • 13.2 Data-driven Processing In A Server (p. 163)
  • 13.3 Data-Driven Processing With A Single Thread (p. 164)
  • 13.4 Process Structure Of A Single-Thread Server (p. 165)
  • 13.5 An Example Single-Thread ECHO Server (p. 166)
  • 13.6 Summary (p. 168)
  • Chapter 14 Multiprotocol Servers (TCP, UDP) (p. 171)
  • 14.1 Introduction (p. 171)
  • 14.2 The Motivation For Reducing The Number Of Servers (p. 171)
  • 14.3 Multiprotocol Server Design (p. 172)
  • 14.4 Process Structure (p. 172)
  • 14.5 An Example Multiprotocol DAYTIME Server (p. 173)
  • 14.6 The Concept Of Shared Code (p. 177)
  • 14.7 Concurrent Multiprotocol Servers (p. 177)
  • 14.8 Summary (p. 178)
  • Chapter 15 Multiservice Servers (TCP, UDP) (p. 179)
  • 15.1 Introduction (p. 179)
  • 15.2 Consolidating Servers (p. 179)
  • 15.3 A Connectionless, Multiservice Server Design (p. 180)
  • 15.4 A Connection-Oriented, Multiservice Server Design (p. 181)
  • 15.5 A Concurrent, Connection-Oriented, Multiservice Server (p. 182)
  • 15.6 A Single-Thread, Multiservice Server Implementation (p. 182)
  • 15.7 Invoking Separate Programs From A Multiservice Server (p. 183)
  • 15.8 Multiservice, Multiprotocol Designs (p. 185)
  • 15.9 An Example Multiservice Server (p. 185)
  • 15.10 Static and Dynamic Server Configuration (p. 192)
  • 15.11 The Super Server, Inetd (p. 193)
  • 15.12 An Example Inetd Server (p. 195)
  • 15.13 A List Of Server Variations (p. 197)
  • 15.14 Summary (p. 197)
  • Chapter 16 Uniform, Efficient Management Of Server Concurrency (p. 199)
  • 16.1 Introduction (p. 199)
  • 16.2 Choosing Between An Iterative And A Concurrent Design (p. 199)
  • 16.3 Level Of Concurrency (p. 200)
  • 16.4 Demand-Driven Concurrency (p. 201)
  • 16.5 The Cost Of Concurrency (p. 201)
  • 16.6 Overhead And Delay (p. 202)
  • 16.7 Small Delays Can Matter (p. 202)
  • 16.8 Slave Preallocation (p. 204)
  • 16.9 Delayed Slave Allocation (p. 208)
  • 16.10 The Uniform Basis For Both Techniques (p. 210)
  • 16.11 Combining Techniques (p. 210)
  • 16.12 Summary (p. 211)
  • Chapter 17 Concurrency In Clients (p. 213)
  • 17.1 Introduction (p. 213)
  • 17.2 The Advantages Of Concurrency (p. 213)
  • 17.3 The Motivation For Exercising Control (p. 214)
  • 17.4 Concurrent Contact With Multiple Servers (p. 215)
  • 17.5 Implementing Concurrent Clients (p. 216)
  • 17.6 Single-Thread Implementations (p. 217)
  • 17.7 An Example Concurrent Client That Uses ECHO (p. 218)
  • 17.8 Execution Of The Concurrent Client (p. 222)
  • 17.9 Concurrency In The Example Code (p. 224)
  • 17.10 Summary (p. 224)
  • Chapter 18 Tunneling At The Transport And Application Levels (p. 227)
  • 18.1 Introduction (p. 227)
  • 18.2 Multiprotocol Environments (p. 227)
  • 18.3 Mixing Network Technologies (p. 229)
  • 18.4 Dynamic Circuit Allocation (p. 230)
  • 18.5 Encapsulation And Tunneling (p. 231)
  • 18.6 Tunneling Through An IP Internet (p. 232)
  • 18.7 Application-Level Tunneling Between Clients And Servers (p. 232)
  • 18.8 Tunneling, Encapsulation, And Dialup Phone Lines (p. 233)
  • 18.9 Summary (p. 234)
  • Chapter 19 Application Level Gateways (p. 237)
  • 19.1 Introduction (p. 237)
  • 19.2 Clients And Servers In Constrained Environments (p. 237)
  • 19.3 Using Application Gateways (p. 238)
  • 19.4 Interoperability Through A Mail Gateway (p. 240)
  • 19.5 Implementation Of A Mail Gateway (p. 240)
  • 19.6 A Comparison Of Application Gateways And Tunneling (p. 241)
  • 19.7 Application Gateways And Limited Internet Connectivity (p. 243)
  • 19.8 Application Gateways Used For Security (p. 245)
  • 19.9 Application Gateways And The Extra Hop Problem (p. 245)
  • 19.10 An Example Application Gateway (p. 247)
  • 19.11 Implementation Of An Application Gateway (p. 248)
  • 19.12 Code For The Application Gateway (p. 250)
  • 19.13 An Example Gateway Exchange (p. 251)
  • 19.14 Using Rfcd With forward Or Slocal (p. 252)
  • 19.15 A General-Purpose Application Gateway (p. 253)
  • 19.16 Operation Of SLIRP (p. 253)
  • 19.17 How SLIRP Handles Connections (p. 254)
  • 19.18 IP Addressing And SLIRP (p. 254)
  • 19.19 Summary (p. 255)
  • Chapter 20 External Data Representation (XDR) (p. 257)
  • 20.1 Introduction (p. 257)
  • 20.2 Representations Of Data (p. 257)
  • 20.3 Asymmetric Conversion And The N-Squared Problem (p. 258)
  • 20.4 Network Standard Byte Order (p. 259)
  • 20.5 A De Facto Standard External Data Representation (p. 261)
  • 20.6 SDR Data Types (p. 261)
  • 20.7 Implicit Types (p. 263)
  • 20.8 Software Support For Using XDR (p. 263)
  • 20.9 SDR Library Routines (p. 263)
  • 20.10 Building A Message One Piece At A Time (p. 264)
  • 20.11 Conversion Routines In The XDR Library (p. 265)
  • 20.12 XDR Streams, I/O, and TCP (p. 267)
  • 20.13 Records, Record Boundaries, And Datagram I/O (p. 268)
  • 20.14 Summary (p. 268)
  • Chapter 21 Remote Procedure Call Concept (RPC) (p. 271)
  • 21.1 Introduction (p. 271)
  • 21.2 Remote Procedure Call Model (p. 271)
  • 21.3 Two Paradigms For Building Distributed Programs (p. 272)
  • 21.4 A Conceptual Model For Conventional Procedure Calls (p. 273)
  • 21.5 An Extension Of the Procedural Model (p. 274)
  • 21.6 Execution Of Conventional Procedure Call And Return (p. 274)
  • 21.7 The Procedural Model In Distributed Systems (p. 275)
  • 21.8 Analogy Between Client-Server And RPC (p. 276)
  • 21.9 Distributed Computation As A Program (p. 277)
  • 21.10 Sun Microsystems' Remote Procedure Call Definition (p. 278)
  • 21.11 Remote Programs And Procedures (p. 278)
  • 21.12 Reducing The Number Of Arguments (p. 279)
  • 21.13 Identifying Remote Programs And Procedures (p. 279)
  • 21.14 Accommodating Multiple Versions Of A Remote Program (p. 280)
  • 21.15 Mutual Exclusion For Procedures In A Remote Program (p. 281)
  • 21.16 Communication Semantics (p. 282)
  • 21.17 At Least Once Semantics (p. 282)
  • 21.18 RPC Retransmission (p. 283)
  • 21.19 Mapping A Remote Program To A Protocol Port (p. 283)
  • 21.20 Dynamic Port Mapping (p. 284)
  • 21.21 RPC Port Mapper Algorithm (p. 285)
  • 21.22 ONC RPC Message Format (p. 287)
  • 21.23 Marshaling Arguments For A Remote Procedure (p. 288)
  • 21.24 Authentication (p. 288)
  • 21.25 An Example Of RPC Message Representation (p. 290)
  • 21.26 An Example Of The UNIX Authentication Field (p. 290)
  • 21.27 Summary (p. 291)
  • Chapter 22 Distributed Program Generation (Rpcgen Concept) (p. 295)
  • 22.1 Introduction (p. 295)
  • 22.2 Using Remote Procedure Calls (p. 296)
  • 22.3 Programming Mechanisms To Support RPC (p. 297)
  • 22.4 Dividing A Program Into Local And Remote Procedures (p. 298)
  • 22.5 Adding Code For RPC (p. 299)
  • 22.6 Stub Procedures (p. 299)
  • 22.7 Multiple Remote Procedures And Dispatching (p. 300)
  • 22.8 Name Of The Client-Side Stub Procedure (p. 301)
  • 22.9 Using Rpcgen To Generate Distributed Programs (p. 302)
  • 22.10 Rpcgen Output And Interface Procedures (p. 302)
  • 22.11 Rpcgen Input And Output (p. 304)
  • 22.12 Using Rpcgen To Build A Client And Server (p. 304)
  • 22.13 Summary (p. 305)
  • Chapter 23 Distributed Program Generation (Rpcgen Example) (p. 307)
  • 23.1 Introduction (p. 307)
  • 23.2 An Example To Illustrate Rpcgen (p. 308)
  • 23.3 Dictionary Operations (p. 308)
  • 23.4 Eight Steps To A Distributed Application (p. 309)
  • 23.5 Step 1: Build A Conventional Application Program (p. 310)
  • 23.6 Step 2: Divide The Program Into Two Parts (p. 314)
  • 23.7 Step 3: Create An Rpcgen Specification (p. 320)
  • 23.8 Step 4: Run Rpcgen (p. 322)
  • 23.9 The .h File Produced By Rpcgen (p. 322)
  • 23.10 The XDR Conversion File Produced By Rpcgen (p. 325)
  • 23.11 The Client Code Produced By Rpcgen (p. 326)
  • 23.12 The Server Code Produced By Rpcgen (p. 328)
  • 23.13 Step 5: Write Stub Interface Procedures (p. 331)
  • 23.14 Step 6: Compile And Link The Client Program (p. 335)
  • 23.15 Step 7: Compile And Link The Server Program (p. 339)
  • 23.16 Step 8: Start The Server And Execute The Client (p. 341)
  • 23.17 Using The Make Utility (p. 341)
  • 23.18 Summary (p. 344)
  • Chapter 24 Network File System Concepts (NFS) (p. 347)
  • 24.1 Introduction (p. 347)
  • 24.2 Remote File Access Vs. Transfer (p. 347)
  • 24.3 Operations On Remote Files (p. 348)
  • 24.4 File Access Among Heterogeneous Computers (p. 348)
  • 24.5 Stateless Servers (p. 349)
  • 24.6 NFS And UNIX File Semantics (p. 349)
  • 24.7 Review Of The UNIX File System (p. 349)
  • 24.8 Files Under NFS (p. 363)
  • 24.9 NFS File Types (p. 364)
  • 24.10 NFS File Modes (p. 364)
  • 24.11 NFS File Attributes (p. 365)
  • 24.12 NFS Client And Server (p. 366)
  • 24.13 NFS Client Operation (p. 367)
  • 24.14 NFS Client And UNIX Systems (p. 368)
  • 24.15 NFS Mounts (p. 369)
  • 24.16 File Handle (p. 370)
  • 24.17 Handles Replace Path Names (p. 370)
  • 24.18 File Positioning With A Stateless Server (p. 372)
  • 24.19 Operations On Directories (p. 372)
  • 24.20 Reading A Directory Statelessly (p. 372)
  • 24.21 Multiple Hierarchies In An NFS Server (p. 373)
  • 24.22 The Mount Protocol (p. 374)
  • 24.23 Transport Protocols For NFS (p. 374)
  • 24.24 Summary (p. 375)
  • Chapter 25 Network File System Protocols (NFS, Mount) (p. 377)
  • 25.1 Introduction (p. 377)
  • 25.2 Using RPC To Define A Protocol (p. 377)
  • 25.3 Defining A Protocol With Data Structures And Procedures (p. 378)
  • 25.4 NFS Constant, Type, And Data Declarations (p. 379)
  • 25.5 NFS Procedures (p. 383)
  • 25.6 Semantics Of NFS Operations (p. 385)
  • 25.7 The Mount Protocol (p. 389)
  • 25.8 Procedures In The Mount Protocol (p. 391)
  • 25.9 Semantics of Mount Operations (p. 391)
  • 25.10 NFS And Mount Authentication (p. 393)
  • 25.11 File Locking (p. 394)
  • 25.12 Changes In NFS Between Versions 3 And 4 (p. 394)
  • 25.13 Summary (p. 395)
  • Chapter 26 A TELNET Client (Program Structure) (p. 397)
  • 26.1 Introduction (p. 397)
  • 26.2 Overview (p. 398)
  • 26.3 A TELNET Client Algorithm (p. 400)
  • 26.4 Terminal I/O In Linux (p. 401)
  • 26.5 Establishing Terminal Modes (p. 403)
  • 26.6 Global Variable Used For Stored State (p. 405)
  • 26.7 Restoring Terminal Modes Before Exit (p. 406)
  • 26.8 Client Suspension And Resumption (p. 407)
  • 26.9 Finite State Machine Specification (p. 408)
  • 26.10 Embedding Commands In A TELNET Data Stream (p. 409)
  • 26.11 Option Negotiation (p. 410)
  • 26.12 Request/Offer Symmetry (p. 410)
  • 26.13 TELNET Character Definitions (p. 411)
  • 26.14 A Finite State Machine For Data From The Server (p. 412)
  • 26.15 Transitions Among States (p. 413)
  • 26.16 A Finite State Machine Implementation (p. 415)
  • 26.17 A Compact FSM Representation (p. 415)
  • 26.18 Keeping The Compact Representation At Run-Time (p. 417)
  • 26.19 Implementation Of A Compact Representation (p. 417)
  • 26.20 Building An FSM Transition Matrix (p. 419)
  • 26.21 The Socket Output Finite State Machine (p. 421)
  • 26.22 Definitions For The Socket Output FSM (p. 423)
  • 26.23 The Option Subnegotiation Finite State Machine (p. 424)
  • 26.24 Definitions For The Option Subnegotiation FSM (p. 425)
  • 26.25 FSM Initialization (p. 426)
  • 26.26 Arguments For The TELNET Client (p. 427)
  • 26.27 The Heart Of The TELNET Client (p. 428)
  • 26.28 Implementation Of The Main FSM (p. 432)
  • 26.29 Summary (p. 433)
  • Chapter 27 A TELNET Client (Implementation Details) (p. 435)
  • 27.1 Introduction (p. 435)
  • 27.2 The FSM Action Procedure (p. 435)
  • 27.3 Recording The Type Of An Option Request (p. 436)
  • 27.4 Performing No Operation (p. 437)
  • 27.5 Responding To WILL/WONT For The Echo Option (p. 437)
  • 27.6 Responding To WILL/WONT For Unsupported Options (p. 439)
  • 27.7 Responding To WILL/WONT For The No Go-Ahead Option (p. 439)
  • 27.8 Generating DO/DONT For Binary Transmission (p. 441)
  • 27.9 Responding To DO/DONT For Unsupported Options (p. 442)
  • 27.10 Responding To DO/DONT For Transmit Binary Option (p. 442)
  • 27.11 Responding To DO/DONT For The Terminal Type Option (p. 444)
  • 27.12 Option Subnegotiation (p. 445)
  • 27.13 Sending Terminal Type Information (p. 446)
  • 27.14 Terminating Subnegotiation (p. 448)
  • 27.15 Sending A Character To The Server (p. 448)
  • 27.16 Displaying Incoming Data On The User's Terminal (p. 450)
  • 27.17 Using Termcap To Control The User's Terminal (p. 453)
  • 27.18 Writing A Block Of Data To The Serve (p. 455)
  • 27.19 Interacting With The Client Process (p. 456)
  • 27.20 Responding To Illegal Commands (p. 456)
  • 27.21 Scripting To A File (p. 457)
  • 27.22 Implementation Of Scripting (p. 457)
  • 27.23 Initialization Of Scripting (p. 458)
  • 27.24 Collecting Characters Of The Script File Name (p. 459)
  • 27.25 Opening A Script File (p. 460)
  • 27.26 Terminating Scripting (p. 462)
  • 27.27 Printing Status Information (p. 463)
  • 27.28 Summary (p. 464)
  • Chapter 28 Streaming Audio And Video Transport (RTP Concept And Design) (p. 467)
  • 28.1 Introduction (p. 467)
  • 28.2 Streaming Service (p. 467)
  • 28.3 Real-Time Delivery (p. 468)
  • 28.4 Protocol Compensation For Jitter (p. 468)
  • 28.5 Retransmission, Loss, And Recovery (p. 469)
  • 28.6 Real-Time Transport Protocol (p. 470)
  • 28.7 Stream Translation And Mixing (p. 471)
  • 28.8 Delayed Playback And Jitter Buffers (p. 471)
  • 28.9 RTP Control Protocol (RTCP) (p. 472)
  • 28.10 Synchronizing Multiple Streams (p. 474)
  • 28.11 RTP Transport And Many-To-Many Transmission (p. 475)
  • 28.12 Sessions, Streams, Protocol Ports, And Demultiplexing (p. 476)
  • 28.13 Basic Approaches To Encoding (p. 477)
  • 28.14 Conceptual Organization Of RTP Software (p. 478)
  • 28.15 Process/Thread Structure (p. 479)
  • 28.16 Semantics Of The API (p. 481)
  • 28.17 Jitter Buffer Design And Rebuffering (p. 482)
  • 28.18 Event Handling (p. 483)
  • 28.19 Playback Anomaly And Timestamp Complications (p. 483)
  • 28.20 Size of An Example Real-Time Library (p. 484)
  • 28.21 An Example MP3 Player (p. 484)
  • 28.22 Summary (p. 485)
  • Chapter 29 Streaming Audio And Video Transport (Example RTP Implementation) (p. 487)
  • 29.1 Introduction (p. 487)
  • 29.2 An Integrated Implementation (p. 487)
  • 29.3 Program Architecture (p. 488)
  • 29.4 RTP Definitions (p. 488)
  • 29.5 Manipulation Of Time Values (p. 492)
  • 29.6 RTP Sequence Space Processing (p. 493)
  • 29.7 RTP Packet Queue Manipulation (p. 494)
  • 29.8 RTP Input Processing (p. 496)
  • 29.9 Keeping Statistics For RTCP (p. 499)
  • 29.10 RTP Initialization (p. 500)
  • 29.11 RTCP Definitions (p. 504)
  • 29.12 Receiving RTCP Sender Reports (p. 506)
  • 29.13 Generating RTCP Receiver Reports (p. 507)
  • 29.14 RTCP Header Creation (p. 509)
  • 29.15 RTCP Delay Computation (p. 510)
  • 29.16 Generation Of An RTCP Bye Message (p. 511)
  • 29.17 Size Of An Integrated Implementation (p. 511)
  • 29.18 Summary (p. 512)
  • Chapter 30 Practical Hints And Techniques For Linux Servers (p. 515)
  • 30.1 Introduction (p. 515)
  • 30.2 Operating In Background (p. 515)
  • 30.3 Programming A Server To Operate In Background (p. 516)
  • 30.4 Open Descriptors And Inheritance (p. 517)
  • 30.5 Programming A Server To Close Inherited Descriptors (p. 518)
  • 30.6 Signals From The Controlling TTY (p. 518)
  • 30.7 Programming A Server To Change Its Controlling TTY (p. 519)
  • 30.8 Moving To A Safe And Known Directory (p. 519)
  • 30.9 Programming A Server To Change Directories (p. 520)
  • 30.10 The Linux Umask (p. 520)
  • 30.11 Programming A Server To Set Its Umask (p. 521)
  • 30.12 Process Groups (p. 521)
  • 30.13 Programming A Server To Set Its Process Group (p. 521)
  • 30.14 Descriptors For Standard I/O (p. 522)
  • 30.15 Programming A Server To Open Standard Descriptors (p. 522)
  • 30.16 Mutual Exclusion For The Server (p. 522)
  • 30.17 Programming A Server To Avoid Multiple Copies (p. 523)
  • 30.18 Recording A Server's Process ID (p. 524)
  • 30.19 Programming A Server To Record Its Process ID (p. 524)
  • 30.20 Waiting For A Child Process To Exit (p. 524)
  • 30.21 Programming A Server To Wait For Each Child To Exit (p. 525)
  • 30.22 Extraneous Signals (p. 525)
  • 30.23 Programming A Server To Ignore Extraneous Signals (p. 525)
  • 30.24 Using A System Log Facility (p. 525)
  • 30.25 Summary (p. 531)
  • Chapter 31 Deadlock And Starvation In Client-Server Systems (p. 533)
  • 31.1 Introduction (p. 533)
  • 31.2 Definition Of Deadlock (p. 534)
  • 31.3 Difficulty Of Deadlock Detection (p. 534)
  • 31.4 Deadlock Avoidance (p. 535)
  • 31.5 Deadlock Between A Client And Server (p. 535)
  • 31.6 Avoiding Deadlock In A Single Interaction (p. 536)
  • 31.7 Starvation Among A Set Of Clients And A Server (p. 536)
  • 31.8 Busy Connections And Starvation (p. 537)
  • 31.9 Avoiding Blocking Operations (p. 538)
  • 31.10 Processes, Connections, And Other Limits (p. 538)
  • 31.11 Cycles Of Clients And Servers (p. 539)
  • 31.12 Documenting Dependencies (p. 540)
  • 31.13 Summary (p. 540)
  • Appendix 1 System Calls And Library Routines Used With Sockets (p. 543)
  • Appendix 2 Manipulation Of Linux File And Socket Descriptors (p. 573)
  • Bibliography (p. 577)
  • Index (p. 585)

Excerpt provided by Syndetics

Preface The Linux operating system is soaring in popularity, and especially important in the networking community as the system for many servers. This new version of Volume 3, which uses Linux, is aimed at programmers who want to understand how to create networking applications. Broadly speaking, it examines the question, "How does application software use TCP/IP protocols to communicate across an internet?" The text focuses on the client-server paradigm, and examines algorithms for both the client and server components of a distributed program. It shows an implementation that illustrates each design, and discusses techniques including application-level gateways and tunneling. In addition, it reviews several standard application protocols, and uses them to illustrate the algorithms and implementation techniques. Although this volume can be read and used alone, it forms part of a larger picture completed by two other volumes in the series. Volume 1 considers the question "What is a TCP/IP internet?" Volume 2 examines the question, "How does TCP/IP software work?" It presents more details, examines working code, and explores greater depth than the first volume. Thus, although a programmer can learn to create network applications from Volume 3 alone, the other volumes can be used to provide a better understanding of the underlying technologies. This version of Volume 3 includes the latest technologies. For example, a chapter explains how a Linux program can use the POSIX thread facilities to create a concurrent server. The chapter on NFS discusses version 3, the version that is about to emerge in the Linux community. In addition, sections have been included to explain concepts behind programs like slirp that provide Internet access over a dialup telephone connection without requiring each computer to have a unique IP address. Two chapters that stand out as especially timely concentrate on streaming and the associated technologies used to send audio and video across the Internet. Chapter 28 describes fundamental concepts such as the Real-time Transport Protocol (RTP), encoding, and jitter buffers. Chapter 29 shows an implementation of RTP that is used to receive and play MP3 audio. The code for all examples in the text is available online. To access a copy via the Web, look for Volume 3 in the list of networking books at location: http://www.cs.purdue.edulhomes/comer/netbooks.html To access the code via FTP, use location: ftp://ftp.cs.purdue.edu/pub/Xinu/TCPIP-vol3.linux.dist.tar.Z The text is organized as follows. Beginning chapters introduce the client-server paradigm and the socket interface that application programs use to access TCP/IP protocol software. They also describe concurrent processes and the operating system functions used to create them. Chapters that follow the introductory material discuss client and server designs. The text explains that the myriad of possible designs are not random. Instead, they follow a pattern that can be understood by considering the choice of concurrency and transport. For example, one chapter discusses a nonconcurrent server design that uses connection-oriented transport (e.g., TCP), while another discusses a similar design that uses connectionless transport (e.g., UDP). We describe how each design fits into the space of possible implementations, but do not try to develop an abstract "theory" of client-server interactions. Instead, we emphasize practical design principles and techniques that are important to programmers. Each technique has advantages in some circumstances, and each has been used in working software. We believe that understanding the conceptual ties among the designs will help the reader appreciate the strengths and 'weaknesses of each approach, and will make it easier to choose among them. The text contains example programs that show how each design operates in practice. Most of the examples implement standard TCP/IP application protocols. In each case, we tried to select an application protocol that would convey a single design idea without being too complex to understand. Thus, while few of the example programs are exciting, they each illustrate one important concept. This version of Volume 3 uses the Linux socket mechanism (i.e., socket API) in all programming examples; two other versions of the text contain many of the same examples using Microsoft's Windows Sockets interface and AT&T's TLI interface. Later chapters focus on middleware. They discuss the remote procedure call concept and describe how it can be used to construct distributed programs. The chapters relate the remote procedure call technique to the client-server model, and show how software can be used to generate client and server programs from a remote procedure call description. The chapters on TELNET show how small details dominate a production program and how complex the code can become for even a simple, character-oriented protocol. The section ends with the two chapters on streaming transport described earlier. Much of the text concentrates on concurrent processing. Many of the concepts described may seem familiar to students who have written concurrent programs because they apply to all concurrent programs, not only network applications. Students who have not written concurrent programs may find the concepts difficult. The text is suitable for a single semester undergraduate course on "socket programming" or a beginning graduate-level course on distributed computing. Because the text concentrates on how to use an internet rather than on how it works, students need little background in networking to understand the material. No particular concept is too difficult for an undergraduate course as long as the instructor proceeds at a suitable pace. A basic course in operating systems concepts or experience with concurrent programming may provide the best background. Students will not appreciate the material until they use it first hand. Thus, any course should have programming exercises that force the students to apply the ideas to practical programs. Undergraduates can learn the basics by repeating the designs on other application protocols. Graduate students should build more complex distributed programs that emphasize some of the subtle techniques (e.g., the concurrency management techniques in Chapter 16 and the interconnection techniques in Chapters 18 and 19 ). We thank many people for their help. Members of the Internet Research Group at Purdue contributed technical information and suggestions to the original text. Michael Evangelists proofread the text and wrote the RTP code. Gustavo Rodriguez-Rivera read several chapters, ran experiments to test details, and edited Appendix 1. Dennis Brylow commented on several chapters. Christine Comer edited the entire text and improved both wording and consistency. Douglas E. Comer David L. Stevens July, 2000 Excerpted from Internetworking with TCP/IP: Client-Server Programming and Applications, Linux/Posix Version by Douglas E. Comer, David L. Stevens All rights reserved by the original copyright owners. Excerpts are provided for display purposes only and may not be reproduced, reprinted or distributed without the written permission of the publisher.

Author notes provided by Syndetics

David Stevens is the winner of eleven Chelsea Flower Show gold medals. He has hosted two popular garden design series on television and is the author of many successful gardening books. He lives in England.

(Bowker Author Biography)

Powered by Koha