Table of Contents: Internetworking With TCP/IP Volume 3
Foreword
Preface
Chapter 1 Introduction And Overview
- 1.1 Use Of TCP/IP 1
- 1.2 Designing Applications For A Distributed Environment 2
- 1.3 Standard And Nonstandard Application Protocols 2
- 1.4 An Example Of Standard Application Protocol Use 2
- 1.5 An Example Connection 3
- 1.6 Using TELNET To Access An Alternative Service 4
- 1.7 Application Protocols And Software Flexibility 6
- 1.8 Viewing Services From The Provider's Perspective 6
- 1.9 The Remainder Of This Text 7
- 1.10 Summary 7
- For Further Study 8
- Exercises 8
Chapter 2 The Client Server Model And Software Design
- 2.1 Introduction 9
- 2.2 Motivation 10
- 2.3 Terminology And Concepts 10
- 2.3.1 Clients And Servers 10
- 2.3.2 Privilege And Complexity 11
- 2.3.3 Standard Vs. Nonstandard Client Software 11
- 2.3.4 Parameterization Of Clients 12
- 2.3.5 Connectionless Vs. Connection-Oriented Servers 13
- 2.3.6 Stateless Vs. Stateful Servers 14
- 2.3.7 A Stateful File Server Example 14
- 2.3.8 Statelessness Is A Protocol Issue 16
- 2.3.9 Servers As Clients 17
- 2.4 Summary 18
- For Further Study 18
- Exercises 18
Chapter 3 Concurrent Processing In Client-Server Software
- 3.1 Introduction 21
- 3.2 Concurrency In Networks 21
- 3.3 Concurrency In Servers 23
- 3.4 Terminology And Concepts 24
- 3.4.1 The Process Concept 25
- 3.4.2 Programs vs. Processes 25
- 3.4.3 Procedure Calls 26
- 3.5 An Example Of Concurrent Process Creation 26
- 3.5.1 A Sequential C Example 26
- 3.5.2 A Concurrent Version 27
- 3.5.3 Timeslicing 29
- 3.5.4 Making Processes Diverge 30
- 3.6 Executing New Code 31
- 3.7 Context Switching And Protocol Software Design 32
- 3.8 Concurrency And Asynchronous I/O 32
- 3.9 Summary 33
- For Further Study 33
- Exercises 33
Chapter 4 Program Interface To Protocols
- 4.1 Introduction 35
- 4.2 Loosely Specified Protocol Software Interface 35
- 4.2.1 Advantages And Disadvantages 36
- 4.3 Interface Functionality 36
- 4.4 Conceptual Interface Specification 37
- 4.5 System Calls 37
- 4.6 Two Basic Approaches To Network Communication 38
- 4.7 The Basic I/O Functions Available In UNIX 39
- 4.8 Using UNIX I/O With TCP/IP 40
- 4.9 Summary 40
- For Further Study 41
- Exercises 41
Chapter 5 The Socket Interface
- 5.1 Introduction 43
- 5.2 Berkeley Sockets 43
- 5.3 Specifying A Protocol Interface 44
- 5.4 The Socket Abstraction 45
- 5.4.1 Socket Descriptors And File Descriptors 45
- 5.4.2 System Data Structures For Sockets 46
- 5.4.3 Using Sockets 47
- 5.5 Specifying An Endpoint Address 47
- 5.6 A Generic Address Structure 48
- 5.7 Major System Calls Used With Sockets 49
- 5.7.1 The Socket Call 49
- 5.7.2 The Connect Call 50
- 5.7.3 The Write Call 50
- 5.7.4 The Read Call 50
- 5.7.5 The Close Call 50
- 5.7.6 The Bind Call 51
- 5.7.7 The Listen Call 51
- 5.7.8 The Accept Call 51
- 5.7.9 Summary Of Socket Calls Used With TCP 51
- 5.8 Utility Routines For Integer Conversion 52
- 5.9 Using Socket Calls In A Program 53
- 5.10 Symbolic Constants For Socket Call Parameters 54
- 5.11 Summary 54
- For Further Study 55
- Exercises 55
Chapter 6 Algorithms And Issues In Client Software Design
- 6.1 Introduction 57
- 6.2 Learning Algorithms Instead Of Details 57
- 6.3 Client Architecture 58
- 6.4 Identifying The Location Of A Server 58
- 6.5 Parsing An Address Argument 60
- 6.6 Looking Up A Domain Name 61
- 6.7 Looking Up A Well-Known Port By Name 62
- 6.8 Port Numbers And Network Byte Order 62
- 6.9 Looking Up A Protocol By Name 63
- 6.10 The TCP Client Algorithm 63
- 6.11 Allocating A Socket 64
- 6.12 Choosing A Local Protocol Port Number 65
- 6.13 A Fundamental Problem In Choosing A Local IP Address 65
- 6.14 Connecting A TCP Socket To A Server 66
- 6.15 Communicating With The Server Using TCP 66
- 6.16 Reading A Response From A TCP Connection 67
- 6.17 Closing A TCP Connection 68
- 6.17.1 The Need For Partial Close 68
- 6.17.2 A Partial Close Operation 68
- 6.18 Programming A UDP Client 69
- 6.19 Connected And Unconnected UDP Sockets 69
- 6.20 Using Connect With UDP 70
- 6.21 Communicating With A Server Using UDP 70
- 6.22 Closing A Socket That Uses UDP 70
- 6.23 Partial Close For UDP 71
- 6.24 A Warning About UDP Unreliability 71
- 6.25 Summary 71
- For Further Study 72
- Exercises 72
Chapter 7 Example Client Software
- 7.1 Introduction 75
- 7.2 The Importance Of Small Examples 75
- 7.3 Hiding Details 76
- 7.4 An Example Procedure Library For Client Programs 76
- 7.5 Implementation Of ConnectTCP 77
- 7.6 Implementation Of ConnectUDP 78
- 7.7 A Procedure That Forms Connections 79
- 7.8 Using The Example Library 81
- 7.9 The DAYTIME Service 82
- 7.10 Implementation Of A TCP Client For DAYTIME 82
- 7.11 Reading From A TCP Connection 84
- 7.12 The TIME Service 84
- 7.13 Accessing The TIME Service 85
- 7.14 Accurate Times And Network Delays 85
- 7.15 A UDP Client For The TIME Service 86
- 7.16 The ECHO Service 88
- 7.17 A TCP Client For The ECHO Service 88
- 7.18 A UDP Client For The ECHO Service 90
- 7.19 Summary 92
- For Further Study 92
- Exercises 92
Chapter 8 Algorithms And Issues In Server Software Design
- 8.1 Introduction 95
- 8.2 The Conceptual Server Algorithm 95
- 8.3 Concurrent Vs. Iterative Servers 96
- 8.4 Connection-Oriented Vs. Connectionless Access 96
- 8.5 Connection-Oriented Servers 97
- 8.6 Connectionless Servers 97
- 8.7 Failure, Reliability, And Statelessness 98
- 8.8 Optimizing Stateless Servers 99
- 8.9 Four Basic Types Of Servers 101
- 8.10 Request Processing Time 102
- 8.11 Iterative Server Algorithms 102
- 8.12 An Iterative, Connection-Oriented Server Algorithm 103
- 8.13 Binding To A Well-Known Address Using INADDR_ANY 103
- 8.14 Placing The Socket In Passive Mode 104
- 8.15 Accepting Connections And Using Them 104
- 8.16 An Iterative, Connectionless Server Algorithm 104
- 8.17 Forming A Reply Address In A Connectionless Server 105
- 8.18 Concurrent Server Algorithms 106
- 8.19 Master And Slave Processes 106
- 8.20 A Concurrent, Connectionless Server Algorithm 107
- 8.21 A Concurrent, Connection-Oriented Server Algorithm 107
- 8.22 Using Separate Programs As Slaves 108
- 8.23 Apparent Concurrency Using A Single Process 109
- 8.24 When To Use Each Server Type 110
- 8.25 A Summary of Server Types 111
- 8.26 The Important Problem Of Server Deadlock 112
- 8.27 Alternative Implementations 112
- 8.28 Summary 113
- For Further Study 113
- Exercises 113
Chapter 9 Iterative, Connectionless Servers (UDP)
- 9.1 Introduction 115
- 9.2 Creating A Passive Socket 115
- 9.3 Process Structure 119
- 9.4 An Example TIME Server 119
- 9.5 Summary 121
- For Further Study 122
- Exercises 122
Chapter 10 Iterative, Connection-Oriented Servers (TCP)
- 10.1 Introduction 123
- 10.2 Allocating A Passive TCP Socket 123
- 10.3 A Server For The DAYTIME Service 124
- 10.4 Process Structure 124
- 10.5 An Example DAYTIME Server 125
- 10.6 Closing Connections 128
- 10.7 Connection Termination And Server Vulnerability 128
- 10.8 Summary 129
- For Further Study 129
- Exercises 129
Chapter 11 Concurrent, Connection-Oriented Servers (TCP)
- 11.1 Introduction 131
- 11.2 Concurrent ECHO 131
- 11.3 Iterative Vs. Concurrent Implementations 132
- 11.4 Process Structure 132
- 11.5 An Example Concurrent ECHO Server 133
- 11.6 Cleaning Up Errant Processes 137
- 11.7 Summary 138
- For Further Study 138
- Exercises 138
Chapter 12 Single-Process, Concurrent Servers (TCP)
- 12.1 Introduction 139
- 12.2 Data-driven Processing In A Server 139
- 12.3 Data-Driven Processing With A Single Process 140
- 12.4 Process Structure Of A Single-Process Server 141
- 12.5 An Example Single-Process ECHO Server 142
- 12.6 Summary 144
- For Further Study 145
- Exercises 145
Chapter 13 Multiprotocol Servers (TCP, UDP)
- 13.1 Introduction 147
- 13.2 The Motivation For Reducing The Number Of Servers 147
- 13.3 Multiprotocol Server Design 148
- 13.4 Process Structure 148
- 13.5 An Example Multiprotocol DAYTIME Server 149
- 13.6 The Concept Of Shared Code 153
- 13.7 Concurrent Multiprotocol Servers 153
- 13.8 Summary 153
- For Further Study 154
- Exercises 154
Chapter 14 Multiservice Servers (TCP, UDP)
- 14.1 Introduction 155
- 14.2 Consolidating Servers 155
- 14.3 A Connectionless, Multiservice Server Design 156
- 14.4 A Connection-Oriented, Multiservice Server Design 157
- 14.5 A Concurrent, Connection-Oriented, Multiservice Server 158
- 14.6 A Single-Process, Multiservice Server Implementation 158
- 14.7 Invoking Separate Programs From A Multiservice Server 159
- 14.8 Multiservice, Multiprotocol Designs 160
- 14.9 An Example Multiservice Server 161
- 14.10 Static and Dynamic Server Configuration 168
- 14.11 The UNIX Super Server, Inetd 169
- 14.12 An Example Inetd Server 171
- 14.13 Summary 173
- For Further Study 173
- Exercises 173
Chapter 15 Uniform, Efficient Management Of Server Concurrency
- 15.1 Introduction 175
- 15.2 Choosing Between An Iterative And A Concurrent Design 175
- 15.3 Level Of Concurrency 176
- 15.4 Demand-Driven Concurrency 177
- 15.5 The Cost Of Concurrency 177
- 15.6 Overhead And Delay 177
- 15.7 Small Delays Can Matter 178
- 15.8 Process Preallocation 179
- 15.8.1 Preallocation In UNIX 180
- 15.8.2 Preallocation In A Connection-Oriented Server 180
- 15.8.3 Preallocation In A Connectionless Server 181
- 15.8.4 Preallocation, Bursty Traffic, And NFS 182
- 15.8.5 Process Preallocation On A Multiprocessor 183
- 15.9 Delayed Process Allocation 183
- 15.10 The Uniform Basis For Both Techniques 184
- 15.11 Combining Techniques 185
- 15.12 Summary 185
- For Further Study 186
- Exercises 186
Chapter 16 Concurrency In Clients
- 16.1 Introduction 187
- 16.2 The Advantages Of Concurrency 187
- 16.3 The Motivation For Exercising Control 188
- 16.4 Concurrent Contact With Multiple Servers 189
- 16.5 Implementing Concurrent Clients 189
- 16.6 Single-Process Implementations 191
- 16.7 An Example Concurrent Client That Uses ECHO 192
- 16.8 Execution Of The Concurrent Client 196
- 16.9 Concurrency In The Example Code 197
- 16.10 Summary 198
- Exercises 198
Chapter 17 Tunneling At The Transport And Application Levels
- 17.1 Introduction 199
- 17.2 Multiprotocol Environments 199
- 17.3 Mixing Network Technologies 201
- 17.4 Dynamic Circuit Allocation 202
- 17.5 Encapsulation And Tunneling 203
- 17.6 Tunneling Through An IP Internet 203
- 17.7 Application-Level Tunneling Between Clients And Servers 204
- 17.8 Tunneling, Encapsulation, And Dialup Phone Lines 205
- 17.9 Summary 206
- For Further Study 206
- Exercises 206
Chapter 18 Application Level Gateways
- 18.1 Introduction 209
- 18.2 Clients And Servers In Constrained Environments 209
- 18.2.1 The Reality Of Multiple Technologies 209
- 18.2.2 Computers With Limited Functionality 210
- 18.2.3 Connectivity Constraints That Arise From Security 210
- 18.3 Using Application Gateways 211
- 18.4 Interoperability Through A Mail Gateway 212
- 18.5 Implementation Of A Mail Gateway 213
- 18.6 A Comparison Of Application Gateways And Tunneling 213
- 18.7 Application Gateways And Limited Functionality Systems 215
- 18.8 Application Gateways Used For Security 216
- 18.9 Application Gateways And The Extra Hop Problem 217
- 18.10 An Example Application Gateway 219
- 18.11 Implementation Of An Application Gateway 220
- 18.12 Code For The Application Gateway 221
- 18.13 An Example Gateway Exchange 223
- 18.14 Using Rfcd With UNIX's .forward 223
- 18.15 A General-Purpose Application Gateway 224
- 18.16 Operation Of SLIRP 224
- 18.17 How SLIRP Handles Connections 225
- 18.18 IP Addressing And SLIRP 225
- 18.19 Summary 226
- For Further Study 227
- Exercises 227
Chapter 19 External Data Representation (XDR)
- 19.1 Introduction 229
- 19.2 Representations For Data In Computers 229
- 19.3 The N-Squared Conversion Problem 230
- 19.4 Network Standard Byte Order 231
- 19.5 A De Facto Standard External Data Representation 232
- 19.6 XDR Data Types 233
- 19.7 Implicit Types 234
- 19.8 Software Support For Using XDR 234
- 19.9 XDR Library Routines 234
- 19.10 Building A Message One Piece At A Time 234
- 19.11 Conversion Routines In The XDR Library 236
- 19.12 XDR Streams, I/O, and TCP 238
- 19.13 Records, Record Boundaries, And Datagram I/O 239
- 19.14 Summary 239
- For Further Study 240
- Exercises 240
Chapter 20 Remote Procedure Call Concept (RPC)
- 20.1 Introduction 241
- 20.2 Remote Procedure Call Model 241
- 20.3 Two Paradigms For Building Distributed Programs 242
- 20.4 A Conceptual Model For Conventional Procedure Calls 243
- 20.5 An Extension Of the Procedural Model 243
- 20.6 Execution Of Conventional Procedure Call And Return 244
- 20.7 The Procedural Model In Distributed Systems 245
- 20.8 Analogy Between Client-Server And RPC 246
- 20.9 Distributed Computation As A Program 247
- 20.10 Sun Microsystems' Remote Procedure Call Definition 248
- 20.11 Remote Programs And Procedures 248
- 20.12 Reducing The Number Of Arguments 249
- 20.13 Identifying Remote Programs And Procedures 249
- 20.14 Accommodating Multiple Versions Of A Remote Program 250
- 20.15 Mutual Exclusion For Procedures In A Remote Program 251
- 20.16 Communication Semantics 252
- 20.17 At Least Once Semantics 252
- 20.18 RPC Retransmission 253
- 20.19 Mapping A Remote Program To A Protocol Port 253
- 20.20 Dynamic Port Mapping 254
- 20.21 RPC Port Mapper Algorithm 255
- 20.22 ONC RPC Message Format 257
- 20.23 Marshaling Arguments For A Remote Procedure 258
- 20.24 Authentication 258
- 20.25 An Example Of RPC Message Representation 259
- 20.26 An Example Of The UNIX Authentication Field 260
- 20.27 Summary 261
- For Further Study 262
- Exercises 262
Chapter 21 Distributed Program Generation (Rpcgen Concept)
- 21.1 Introduction 265
- 21.2 Using Remote Procedure Calls 266
- 21.3 Programming Mechanisms To Support RPC 267
- 21.4 Dividing A Program Into Local And Remote Procedures 268
- 21.5 Adding Code For RPC 269
- 21.6 Stub Procedures 269
- 21.7 Multiple Remote Procedures And Dispatching 270
- 21.8 Name Of The Client-Side Stub Procedure 271
- 21.9 Using Rpcgen To Generate Distributed Programs 272
- 21.10 Rpcgen Output And Interface Procedures 272
- 21.11 Rpcgen Input And Output 273
- 21.12 Using Rpcgen To Build A Client And Server 274
- 21.13 Summary 274
- For Further Study 276
- Exercises 276
Chapter 22 Distributed Program Generation (Rpcgen Example)
- 22.1 Introduction 277
- 22.2 An Example To Illustrate Rpcgen 278
- 22.3 Dictionary Look Up 278
- 22.4 Eight Steps To A Distributed Application 279
- 22.5 Step 1: Build A Conventional Application Program 280
- 22.6 Step 2: Divide The Program Into Two Parts 284
- 22.7 Step 3: Create An Rpcgen Specification 290
- 22.8 Step 4: Run Rpcgen 292
- 22.9 The .h File Produced By Rpcgen 292
- 22.10 The XDR Conversion File Produced By Rpcgen 293
- 22.11 The Client Code Produced By Rpcgen 294
- 22.12 The Server Code Produced By Rpcgen 296
- 22.13 Step 5: Write Stub Interface Procedures 299
- 22.13.1 Client-Side Interface Routines 299
- 22.13.2 Server-Side Interface Routines 301
- 22.14 Step 6: Compile And Link The Client Program 303
- 22.15 Step 7: Compile And Link The Server Program 307
- 22.16 Step 8: Start The Server And Execute The Client 309
- 22.17 Using The UNIX Make Utility 309
- 22.18 Summary 311
- For Further Study 312
- Exercises 312
Chapter 23 Network File System Concepts (NFS)
- 23.1 Introduction 315
- 23.2 Remote File Access Vs. Transfer 315
- 23.3 Operations On Remote Files 316
- 23.4 File Access Among Heterogeneous Computers 316
- 23.5 Stateless Servers 317
- 23.6 NFS And UNIX File Semantics 317
- 23.7 Review Of The UNIX File System 317
- 23.7.1 Basic Definitions 317
- 23.7.2 A Byte Sequence Without Record Boundaries 318
- 23.7.3 A File's Owner And Group Identifiers 318
- 23.7.4 Protection And Access 318
- 23.7.5 The Open-Read-Write-Close Paradigm 320
- 23.7.6 Data Transfer 321
- 23.7.7 Permission To Search A Directory 321
- 23.7.8 Random Access 321
- 23.7.9 Seeking Beyond The End Of File 322
- 23.7.10 File Position And Concurrent Access 323
- 23.7.11 Semantics Of Write During Concurrent Access 324
- 23.7.12 File Names And Paths 324
- 23.7.13 Inode: Information Stored With A File 325
- 23.7.14 Stat Operation 326
- 23.7.15 The File Naming Mechanism 327
- 23.7.16 File System Mounts 328
- 23.7.17 UNIX File Name Resolution 330
- 23.7.18 Symbolic Links 331
- 23.8 Files Under NFS 331
- 23.9 NFS File Types 332
- 23.10 NFS File Modes 332
- 23.11 NFS File Attributes 333
- 23.12 NFS Client And Server 334
- 23.13 NFS Client Operation 335
- 23.14 NFS Client And UNIX 336
- 23.15 NFS Mounts 337
- 23.16 File Handle 338
- 23.17 Handles Replace Path Names 338
- 23.18 An NFS Client In UNIX 340
- 23.19 File Positioning With A Stateless Server 340
- 23.20 Operations On Directories 341
- 23.21 Reading A Directory Statelessly 341
- 23.22 Multiple Hierarchies In An NFS Server 342
- 23.23 The Mount Protocol 342
- 23.24 Summary 343
- For Further Study 343
- Exercises 343
Chapter 24 Network File System Protocol (NFS, Mount)
- 24.1 Introduction 345
- 24.2 Using RPC To Define A Protocol 345
- 24.3 Defining A Protocol With Data Structures And Procedures 346
- 24.4 NFS Constant, Type, And Data Declarations 347
- 24.4.1 NFS Constants 347
- 24.4.2 NFS Typedef Declarations 348
- 24.4.3 NFS Data Structures 348
- 24.5 NFS Procedures 350
- 24.6 Semantics Of NFS Operations 351
- 24.6.1 NFSPROC_NULL (Procedure 0) 352
- 24.6.2 NFSPROC_GETATTR (Procedure 1) 352
- 24.6.3 NFSPROC_SETATTR (Procedure 2) 352
- 24.6.4 NFSPROC_ROOT (Procedure 3) [Obsolete in NFS3] 352
- 24.6.5 NFSPROC_LOOKUP (Procedure 4) 352
- 24.6.6 NFSPROC_READLINK (Procedure 5) 352
- 24.6.7 NFSPROC_READ (Procedure 6) 352
- 24.6.8 NFSPROC_WRITECACHE (Procedure 7) [Obsolete in NFS3] 352
- 24.6.9 NFSPROC_WRITE (Procedure 8) 353
- 24.6.10 NFSPROC_CREATE (Procedure 9) 353
- 24.6.11 NFSPROC_REMOVE (Procedure 10) 353
- 24.6.12 NFSPROC_RENAME (Procedure 11) 353
- 24.6.13 NFSPROC_LINK (Procedure 12) 353
- 24.6.14 NFSPROC_SYMLINK (Procedure 13) 353
- 24.6.15 NFSPROC_MKDIR (Procedure 14) 354
- 24.6.16 NFSPROC_RMDIR (Procedure 15) 354
- 24.6.17 NFSPROC_READDIR (Procedure 16) 354
- 24.6.18 NFSPROC_STATFS (Procedure 17) 354
- 24.7 The Mount Protocol 355
- 24.7.1 Mount Constant Definitions 355
- 24.7.2 Mount Type Definitions 355
- 24.7.3 Mount Data Structures 356
- 24.8 Procedures In The Mount Protocol 357
- 24.9 Semantics of Mount Operations 357
- 24.9.1 MNTPROC_NULL (Procedure 0) 357
- 24.9.2 MNTPROC_MNT (Procedure 1) 357
- 24.9.3 MNTPROC_DUMP (Procedure 2) 358
- 24.9.4 MNTPROC_UMNT (Procedure 3) 358
- 24.9.5 MNTPROC_UMNTALL (Procedure 4) 358
- 24.9.6 MNTPROC_EXPORT (Procedure 5) 358
- 24.10 NFS And Mount Authentication 358
- 24.11 Changes In NFS Version 3 360
- 24.12 Summary 361
- For Further Study 361
- Exercises 362
Chapter 25 A TELNET Client (Program Structure)
- 25.1 Introduction 363
- 25.2 Overview 364
- 25.2.1 The User's Terminal 364
- 25.2.2 Command And Control Information 364
- 25.2.3 Terminals, Windows, and Files 364
- 25.2.4 The Need For Concurrency 365
- 25.2.5 A Process Model For A TELNET Client 366
- 25.3 A TELNET Client Algorithm 366
- 25.4 Terminal I/O In UNIX 367
- 25.4.1 Controlling A Device Driver 368
- 25.5 Establishing Terminal Modes 369
- 25.6 Global Variable Used For Stored State 371
- 25.7 Restoring Terminal Modes Before Exit 372
- 25.8 Client Suspension And Resumption 373
- 25.9 Finite State Machine Specification 374
- 25.10 Embedding Commands In A TELNET Data Stream 375
- 25.11 Option Negotiation 376
- 25.12 Request/Offer Symmetry 376
- 25.13 TELNET Character Definitions 376
- 25.14 A Finite State Machine For Data From The Server 378
- 25.15 Transitions Among States 379
- 25.16 A Finite State Machine Implementation 381
- 25.17 A Compact FSM Representation 381
- 25.18 Keeping The Compact Representation At Run-Time 383
- 25.19 Implementation Of A Compact Representation 383
- 25.20 Building An FSM Transition Matrix 385
- 25.21 The Socket Output Finite State Machine 387
- 25.22 Definitions For The Socket Output FSM 390
- 25.23 The Option Subnegotiation Finite State Machine 391
- 25.24 Definitions For The Option Subnegotiation FSM 392
- 25.25 FSM Initialization 393
- 25.26 Arguments For The TELNET Client 394
- 25.27 The Heart Of The TELNET Client 395
- 25.28 Implementation Of The Main FSM 399
- 25.29 Summary 401
- For Further Study 401
- Exercises 401
Chapter 26 A TELNET Client (Implementation Details)
- 26.1 Introduction 403
- 26.2 The FSM Action Procedures 403
- 26.3 Recording The Type Of An Option Request 404
- 26.4 Performing No Operation 405
- 26.5 Responding To WILL/WONT For The Echo Option 405
- 26.6 Responding To WILL/WONT For Unsupported Options 407
- 26.7 Responding To WILL/WONT For The No Go-Ahead Option 407
- 26.8 Generating DO/DONT For Binary Transmission 409
- 26.9 Responding To DO/DONT For Unsupported Options 410
- 26.10 Responding To DO/DONT For Transmit Binary Option 410
- 26.11 Responding To DO/DONT For The Terminal Type Option 412
- 26.12 Option Subnegotiation 413
- 26.13 Sending Terminal Type Information 414
- 26.14 Terminating Subnegotiation 416
- 26.15 Sending A Character To The Server 416
- 26.16 Displaying Incoming Data On The User's Terminal 418
- 26.17 Using Termcap To Control The User's Terminal 421
- 26.18 Writing A Block Of Data To The Server 422
- 26.19 Interacting With The Client Process 424
- 26.20 Responding To Illegal Commands 424
- 26.21 Scripting To A File 425
- 26.22 Implementation Of Scripting 425
- 26.23 Initialization Of Scripting 426
- 26.24 Collecting Characters Of The Script File Name 427
- 26.25 Opening A Script File 428
- 26.26 Terminating Scripting 430
- 26.27 Printing Status Information 431
- 26.28 Summary 432
- For Further Study 432
- Exercises 433
Chapter 27 Practical Hints And Techniques For UNIX Servers
- 27.1 Introduction 435
- 27.2 Operating In Background 435
- 27.3 Programming A Server To Operate In Background 436
- 27.4 Open Descriptors And Inheritance 437
- 27.5 Programming A Server To Close Inherited Descriptors 438
- 27.6 Signals From The Controlling TTY 438
- 27.7 Programming A Server To Change Its Controlling TTY 438
- 27.8 Moving To A Safe And Known Directory 439
- 27.9 Programming A Server To Change Directories 439
- 27.10 The UNIX Umask 440
- 27.11 Programming A Server To Set Its Umask 440
- 27.12 Process Groups 440
- 27.13 Programming A Server To Set Its Process Group 441
- 27.14 Descriptors For Standard I/O 441
- 27.15 Programming A Server To Open Standard Descriptors 441
- 27.16 Mutual Exclusion For The Server 442
- 27.17 Programming A Server To Avoid Multiple Copies 442
- 27.18 Recording A Server's Process ID 443
- 27.19 Programming A Server To Record Its Process ID 443
- 27.20 Waiting For A Child Process To Exit 444
- 27.21 Programming A Server To Wait For Each Child To Exit 444
- 27.22 Extraneous Signals 444
- 27.23 Programming A Server To Ignore Extraneous Signals 445
- 27.24 Using A System Log Facility 445
- 27.24.1 Generating Log Messages 445
- 27.24.2 The Advantage Of Indirection And Standard Error 445
- 27.24.3 Limitations Of I/O Redirection 446
- 27.24.4 A Client-Server Solution 446
- 27.24.5 The Syslog Mechanism 447
- 27.24.6 Syslog Message Classes 447
- 27.24.7 Syslog Facilities 447
- 27.24.8 Syslog Priority Levels 448
- 27.24.9 Using Syslog 448
- 27.24.10 An Example Syslog Configuration File 449
- 27.25 Summary 450
- For Further Study 450
- Exercises 451
Chapter 28 Deadlock And Starvation In Client-Server Systems
- 28.1 Introduction 453
- 28.2 Definition Of Deadlock 454
- 28.3 Difficulty Of Deadlock Detection 454
- 28.4 Deadlock Avoidance 455
- 28.5 Deadlock Between A Client And Server 455
- 28.6 Avoiding Deadlock In A Single Interaction 456
- 28.7 Starvation Among A Set Of Clients And A Server 456
- 28.8 Busy Connections And Starvation 457
- 28.9 Avoiding Blocking Operations 458
- 28.10 Processes, Connections, And Other Limits 458
- 28.11 Cycles Of Clients And Servers 459
- 28.12 Documenting Dependencies 459
- 28.13 Summary 460
- Exercises 461
- For Further Study 496
- Exercises 496
Bibliography
Index