Table of Contents: Internetworking With TCP/IP Volume 3
TLI version (System V UNIX)
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 5
- 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 7
- 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 31
- 3.8 Concurrency And Asynchronous I/O 32
- 3.9 Summary 32
- 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 Transport Layer Interface (TLI)
- 5.1 Introduction 43
- 5.2 Background 43
- 5.3 Specifying A Protocol Interface 44
- 5.4 The Basic TLI Abstractions 45
- 5.5 Practical Limitations On Portability 46
- 5.6 Programs, Linking, And Shared Libraries 46
- 5.7 TLI Communication Descriptors 47
- 5.8 Using A File Path To Specify Protocol Software 48
- 5.9 Specifying An Endpoint Address 48
- 5.10 An Address Structure For TCP/IP 49
- 5.11 Principle Function Calls Used With TLI 50
- 5.11.1 The T_open Function 51
- 5.11.2 The T_bind Function 51
- 5.11.3 The T_alloc Function 52
- 5.11.4 The T_listen Function 52
- 5.11.5 The T_accept Function 53
- 5.11.6 The T_connect Function 53
- 5.11.7 The T_snd Function 53
- 5.11.8 The T_rcv Function 54
- 5.11.9 The T_sndudata Function 54
- 5.11.10 The T_rcvudata Function 54
- 5.11.11 The T_close Function 55
- 5.12 Summary Of TLI Functions Used With TCP/IP 55
- 5.13 Utility Routines For Integer Conversion 56
- 5.14 Using TLI Functions In A Program 56
- 5.15 Predefined Structures And Symbolic Constants 57
- 5.16 Summary 58
- For Further Study 58
- Exercises 59
Chapter 6 Algorithms And Issues In Client Software Design
- 6.1 Introduction 61
- 6.2 Learning Algorithms Instead Of Details 61
- 6.3 Client Architecture 62
- 6.4 Identifying The Location Of A Server 62
- 6.5 Parsing An Address Argument 64
- 6.6 Looking Up A Domain Name 65
- 6.7 Looking Up A Well-Known Port By Name 66
- 6.8 Port Numbers And Network Byte Order 66
- 6.9 The TCP Client Algorithm 67
- 6.10 Allocating A Descriptor 67
- 6.11 Choosing A Local Protocol Port Number 68
- 6.12 A Fundamental Problem In Choosing A Local IP Address 68
- 6.13 Connecting To A Server With TCP 69
- 6.14 Communicating With The Server Using TCP 69
- 6.15 Reading A Response From A TCP Connection 70
- 6.16 Terminating A TCP Connection 71
- 6.16.1 The Need For Partial Release 71
- 6.16.2 A Partial Close Operation 71
- 6.17 Programming A UDP Client 72
- 6.18 Communicating With A Server Using UDP 73
- 6.19 Deallocating A Descriptor That Uses UDP 73
- 6.20 A Warning About UDP Unreliability 73
- 6.21 Summary 74
- For Further Study 74
- Exercises 74
Chapter 7 Example Client Software
- 7.1 Introduction 77
- 7.2 The Importance Of Small Examples 77
- 7.3 Hiding Details 78
- 7.4 An Example Procedure Library For Client Programs 78
- 7.5 Implementation Of ClientTCP 79
- 7.6 Implementation Of ClientUDP 81
- 7.7 A Procedure That Forms Connections 82
- 7.8 Using The Example Library 84
- 7.9 The DAYTIME Service 85
- 7.10 Implementation Of A TCP Client For DAYTIME 85
- 7.11 Reading From A TCP Connection 87
- 7.12 The TIME Service 88
- 7.13 Accessing The TIME Service 88
- 7.14 Accurate Times And Network Delays 89
- 7.15 A UDP Client For The TIME Service 89
- 7.16 The ECHO Service 92
- 7.17 A TCP Client For The ECHO Service 92
- 7.18 A UDP Client For The ECHO Service 94
- 7.19 Summary 96
- For Further Study 96
- Exercises 96
Chapter 8 Algorithms And Issues In Server Software Design
- 8.1 Introduction 99
- 8.2 The Conceptual Server Algorithm 99
- 8.3 Concurrent Vs. Iterative Servers 100
- 8.4 Connection-Oriented Vs. Connectionless Access 100
- 8.5 Connection-Oriented Servers 101
- 8.6 Connectionless Servers 101
- 8.7 Failure, Reliability, And Statelessness 102
- 8.8 Optimizing Stateless Servers 103
- 8.9 Four Basic Types Of Servers 105
- 8.10 Request Processing Time 106
- 8.11 Iterative Server Algorithms 106
- 8.12 An Iterative, Connection-Oriented Server Algorithm 107
- 8.13 Binding To A Well-Known Address Using INADDR_ANY 107
- 8.14 Waiting For A Connection Request 108
- 8.15 Accepting Connections And Using Them 108
- 8.16 An Iterative, Connectionless Server Algorithm 108
- 8.17 Forming A Reply Address In A Connectionless Server 109
- 8.18 Concurrent Server Algorithms 109
- 8.19 Master And Slave Processes 110
- 8.20 A Concurrent, Connectionless Server Algorithm 110
- 8.21 A Concurrent, Connection-Oriented Server Algorithm 111
- 8.22 Using Separate Programs As Slaves 112
- 8.23 Apparent Concurrency Using A Single Process 112
- 8.24 When To Use Each Server Type 113
- 8.25 A Summary of Server Types 114
- 8.26 The Important Problem Of Server Deadlock 115
- 8.27 Alternative Implementations 116
- 8.28 Summary 116
- For Further Study 116
- Exercises 116
Chapter 9 Iterative, Connectionless Servers (UDP)
- 9.1 Introduction 119
- 9.2 Creating A Passive Descriptor 119
- 9.3 Process Structure 123
- 9.4 An Example TIME Server 123
- 9.5 Summary 126
- For Further Study 126
- Exercises 126
Chapter 10 Iterative, Connection-Oriented Servers (TCP)
- 10.1 Introduction 129
- 10.2 Allocating A Passive TCP Descriptor 129
- 10.3 A Server For The DAYTIME Service 130
- 10.4 Process Structure 130
- 10.5 An Example DAYTIME Server 131
- 10.6 Closing Connections 135
- 10.7 Connection Termination And Server Vulnerability 136
- 10.8 Summary 136
- For Further Study 137
- Exercises 137
Chapter 11 Concurrent, Connection-Oriented Servers (TCP)
- 11.1 Introduction 139
- 11.2 Concurrent ECHO 139
- 11.3 Iterative Vs. Concurrent Implementations 140
- 11.4 Process Structure 140
- 11.5 An Example Concurrent ECHO Server 141
- 11.6 Notification Of Child Exit 144
- 11.7 Summary 144
- For Further Study 145
- Exercises 145
Chapter 12 Single-Process, Concurrent Servers (TCP)
- 12.1 Introduction 147
- 12.2 Data-Driven Processing In A Server 147
- 12.3 Data-Driven Processing With A Single Process 148
- 12.4 Process Structure Of A Single-Process Server 149
- 12.5 An Example Single-Process ECHO Server 150
- 12.6 Summary 152
- For Further Study 152
- Exercises 153
Chapter 13 Multiprotocol Servers (TCP, UDP)
- 13.1 Introduction 155
- 13.2 The Motivation For Reducing The Number Of Servers 155
- 13.3 Multiprotocol Server Design 156
- 13.4 Process Structure 156
- 13.5 An Example Multiprotocol DAYTIME Server 157
- 13.6 The Concept Of Shared Code 161
- 13.7 Concurrent Multiprotocol Servers 161
- 13.8 Summary 162
- For Further Study 162
- Exercises 162
Chapter 14 Multiservice Servers (TCP, UDP)
- 14.1 Introduction 163
- 14.2 Consolidating Servers 163
- 14.3 A Connectionless, Multiservice Server Design 164
- 14.4 A Connection-Oriented, Multiservice Server Design 165
- 14.5 A Concurrent, Connection-Oriented, Multiservice Server 166
- 14.6 A Single-Process, Multiservice Server Implementation 166
- 14.7 Invoking Separate Programs From A Multiservice Server 167
- 14.8 Multiservice, Multiprotocol Designs 168
- 14.9 An Example Multiservice Server 169
- 14.10 The UNIX Super Server, Inetd 175
- 14.11 Summary 176
- For Further Study 176
- Exercises 176
Chapter 15 Uniform, Efficient Management Of Server Concurrency
- 15.1 Introduction 179
- 15.2 Choosing Between An Iterative And A Concurrent Design 179
- 15.3 Level Of Concurrency 180
- 15.4 Demand-Driven Concurrency 181
- 15.5 The Cost Of Concurrency 181
- 15.6 Overhead And Delay 181
- 15.7 Small Delays Can Matter 182
- 15.8 Process Preallocation 183
- 15.8.1 Preallocation In UNIX 184
- 15.8.2 Preallocation In A Connection-Oriented Server 184
- 15.8.3 Preallocation In A Connectionless Server 185
- 15.8.4 Preallocation, Bursty Traffic, And NFS 186
- 15.8.5 Process Preallocation On A Multiprocessor 187
- 15.9 Delayed Process Allocation 187
- 15.10 The Uniform Basis For Both Techniques 188
- 15.11 Combining Techniques 189
- 15.12 Summary 189
- For Further Study 190
- Exercises 190
Chapter 16 Concurrency In Clients
- 16.1 Introduction 191
- 16.2 The Advantages Of Concurrency 191
- 16.3 The Motivation For Exercising Control 192
- 16.4 Concurrent Contact With Multiple Servers 193
- 16.5 Implementing Concurrent Clients 193
- 16.6 Single-Process Implementations 195
- 16.7 An Example Concurrent Client That Uses ECHO 196
- 16.8 Execution Of The Concurrent Client 200
- 16.9 Concurrency In The Example Code 202
- 16.10 Summary 202
- Exercises 202
Chapter 17 Tunneling At The Transport And Application Levels
- 17.1 Introduction 205
- 17.2 Multiprotocol Environments 205
- 17.3 Mixing Network Technologies 207
- 17.4 Dynamic Circuit Allocation 208
- 17.5 Encapsulation And Tunneling 209
- 17.6 Tunneling Through An IP Internet 209
- 17.7 Application-Level Tunneling Between Clients And Servers 210
- 17.8 Summary 211
- For Further Study 212
- Exercises 212
Chapter 18 Application Level Gateways
- 18.1 Introduction 213
- 18.2 Clients And Servers In Constrained Environments 213
- 18.2.1 The Reality Of Multiple Technologies 213
- 18.2.2 Computers With Limited Functionality 214
- 18.2.3 Connectivity Constraints That Arise From Security 214
- 18.3 Using Application Gateways 215
- 18.4 Interoperability Through A Mail Gateway 216
- 18.5 Implementation Of A Mail Gateway 217
- 18.6 A Comparison Of Application Gateways And Tunneling 217
- 18.7 Application Gateways And Limited Functionality Systems 219
- 18.8 Application Gateways Used For Security 220
- 18.9 Application Gateways And The Extra Hop Problem 221
- 18.10 An Example Application Gateway 223
- 18.11 Implementation Of An Application Gateway 224
- 18.12 Code For The Application Gateway 226
- 18.13 An Example Gateway Exchange 227
- 18.14 Using Rfcd With UNIX's .forward 228
- 18.15 Summary 228
- For Further Study 229
- Exercises 229
Chapter 19 External Data Representation (XDR)
- 19.1 Introduction 231
- 19.2 Representations For Data In Computers 231
- 19.3 The N-Squared Conversion Problem 232
- 19.4 Network Standard Byte Order 233
- 19.5 A De Facto Standard External Data Representation 234
- 19.6 XDR Data Types 235
- 19.7 Implicit Types 236
- 19.8 Software Support For Using XDR 236
- 19.9 XDR Library Routines 236
- 19.10 Building A Message One Piece At A Time 236
- 19.11 Conversion Routines In The XDR Library 238
- 19.12 XDR Streams, I/O, and TCP 240
- 19.13 Records, Record Boundaries, And Datagram I/O 241
- 19.14 Summary 241
- For Further Study 242
- Exercises 242
Chapter 20 Remote Procedure Call Concept (RPC)
- 20.1 Introduction 243
- 20.2 Remote Procedure Call Model 243
- 20.3 Two Paradigms For Building Distributed Programs 244
- 20.4 A Conceptual Model For Conventional Procedure Calls 245
- 20.5 An Extension Of the Procedural Model 245
- 20.6 Execution Of Conventional Procedure Call And Return 246
- 20.7 The Procedural Model In Distributed Systems 247
- 20.8 Analogy Between Client-Server And RPC 248
- 20.9 Distributed Computation As A Program 249
- 20.10 Sun Microsystems' Remote Procedure Call Definition 250
- 20.11 Remote Programs And Procedures 250
- 20.12 Reducing The Number Of Arguments 251
- 20.13 Identifying Remote Programs And Procedures 251
- 20.14 Accommodating Multiple Versions Of A Remote Program 252
- 20.15 Mutual Exclusion For Procedures In A Remote Program 253
- 20.16 Communication Semantics 254
- 20.17 At Least Once Semantics 254
- 20.18 RPC Retransmission 255
- 20.19 Mapping A Remote Program To A Protocol Port 255
- 20.20 Dynamic Port Mapping 256
- 20.21 RPC Port Mapper Algorithm 257
- 20.22 Sun RPC Message Format 259
- 20.23 Marshaling Arguments For A Remote Procedure 260
- 20.24 Authentication 260
- 20.25 An Example Of RPC Message Representation 261
- 20.26 An Example Of The UNIX Authentication Field 262
- 20.27 Summary 263
- For Further Study 264
- Exercises 264
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 Lookup 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 294
- 22.11 The Client Code Produced By Rpcgen 295
- 22.12 The Server Code Produced By Rpcgen 297
- 22.13 Step 5: Write Stub Interface Procedures 302
- 22.13.1 Client-Side Interface Routines 302
- 22.13.2 Server-Side Interface Routines 304
- 22.14 Step 6: Compile And Link The Client Program 306
- 22.15 Step 7: Compile And Link The Server Program 309
- 22.16 Step 8: Start The Server And Execute The Client 312
- 22.17 Using The UNIX Make Utility 312
- 22.18 Summary 315
- For Further Study 315
- Exercises 315
Chapter 23 Network File System Concepts (NFS)
- 23.1 Introduction 317
- 23.2 Remote File Access Vs. Transfer 317
- 23.3 Operations On Remote Files 318
- 23.4 File Access Among Heterogeneous Computers 318
- 23.5 Stateless Servers 319
- 23.6 NFS And UNIX File Semantics 319
- 23.7 Review Of The UNIX File System 319
- 23.7.1 Basic Definitions 319
- 23.7.2 A Byte Sequence Without Record Boundaries 320
- 23.7.3 A File's Owner And Group Identifiers 320
- 23.7.4 Protection And Access 320
- 23.7.5 The Open-Read-Write-Close Paradigm 322
- 23.7.6 Data Transfer 323
- 23.7.7 Permission To Search A Directory 323
- 23.7.8 Random Access 323
- 23.7.9 Seeking Beyond The End Of File 324
- 23.7.10 File Position And Concurrent Access 325
- 23.7.11 Semantics Of Write During Concurrent Access 326
- 23.7.12 File Names And Paths 326
- 23.7.13 Inode: Information Stored With A File 327
- 23.7.14 Stat Operation 329
- 23.7.15 The File Naming Mechanism 329
- 23.7.16 File System Mounts 330
- 23.7.17 UNIX File Name Resolution 332
- 23.7.18 Symbolic Links 333
- 23.8 Files Under NFS 333
- 23.9 NFS File Types 334
- 23.10 NFS File Modes 334
- 23.11 NFS File Attributes 335
- 23.12 NFS Client And Server 336
- 23.13 NFS Client Operation 337
- 23.14 NFS Client And UNIX 338
- 23.15 NFS Mounts 339
- 23.16 File Handle 340
- 23.17 Handles Replace Path Names 340
- 23.18 An NFS Client In UNIX 342
- 23.19 File Positioning With A Stateless Server 342
- 23.20 Operations On Directories 343
- 23.21 Reading A Directory Statelessly 343
- 23.22 Multiple Hierarchies In An NFS Server 344
- 23.23 The Mount Protocol 344
- 23.24 Summary 345
- For Further Study 345
- Exercises 345
Chapter 24 Network File System Protocol (NFS, Mount)
- 24.1 Introduction 347
- 24.2 Using RPC To Define A Protocol 347
- 24.3 Defining A Protocol With Data Structures And Procedures 348
- 24.4 NFS Constant, Type, And Data Declarations 349
- 24.4.1 NFS Constants 349
- 24.4.2 NFS Typedef Declarations 350
- 24.4.3 NFS Data Structures 350
- 24.5 NFS Procedures 352
- 24.6 Semantics Of NFS Operations 353
- 24.6.1 NFSPROC_NULL (Procedure 0) 354
- 24.6.2 NFSPROC_GETATTR (Procedure 1) 354
- 24.6.3 NFSPROC_SETATTR (Procedure 2) 354
- 24.6.4 NFSPROC_ROOT (Procedure 3) 354
- 24.6.5 NFSPROC_LOOKUP (Procedure 4) 354
- 24.6.6 NFSPROC_READLINK (Procedure 5) 354
- 24.6.7 NFSPROC_READ (Procedure 6) 354
- 24.6.8 NFSPROC_WRITECACHE (Procedure 7) 354
- 24.6.9 NFSPROC_WRITE (Procedure 8) 355
- 24.6.10 NFSPROC_CREATE (Procedure 9) 355
- 24.6.11 NFSPROC_REMOVE (Procedure 10) 355
- 24.6.12 NFSPROC_RENAME (Procedure 11) 355
- 24.6.13 NFSPROC_LINK (Procedure 12) 355
- 24.6.14 NFSPROC_SYMLINK (Procedure 13) 355
- 24.6.15 NFSPROC_MKDIR (Procedure 14) 356
- 24.6.16 NFSPROC_RMDIR (Procedure 15) 356
- 24.6.17 NFSPROC_READDIR (Procedure 16) 356
- 24.6.18 NFSPROC_STATFS (Procedure 17) 356
- 24.7 The Mount Protocol 357
- 24.7.1 Mount Constant Definitions 357
- 24.7.2 Mount Type Definitions 357
- 24.7.3 Mount Data Structures 358
- 24.8 Procedures In The Mount Protocol 359
- 24.9 Semantics of Mount Operations 359
- 24.9.1 MNTPROC_NULL (Procedure 0) 359
- 24.9.2 MNTPROC_MNT (Procedure 1) 359
- 24.9.3 MNTPROC_DUMP (Procedure 2) 360
- 24.9.4 MNTPROC_UMNT (Procedure 3) 360
- 24.9.5 MNTPROC_UMNTALL (Procedure 4) 360
- 24.9.6 MNTPROC_EXPORT (Procedure 5) 360
- 24.10 NFS And Mount Authentication 360
- 24.11 Summary 362
- For Further Study 362
- Exercises 362
Chapter 25 A TELNET Client (Program Structure)
- 25.1 Introduction 365
- 25.2 Overview 366
- 25.2.1 The User's Terminal 366
- 25.2.2 Command And Control Information 366
- 25.2.3 Terminals, Windows, and Files 366
- 25.2.4 The Need For Concurrency 367
- 25.2.5 A Process Model For A TELNET Client 368
- 25.3 A TELNET Client Algorithm 368
- 25.4 Terminal I/O In UNIX 369
- 25.4.1 Controlling A Device Driver 370
- 25.5 Establishing Terminal Modes 371
- 25.6 Global Variable Used For Stored State 373
- 25.7 Restoring Terminal Modes Before Exit 374
- 25.8 Client Suspension And Resumption 375
- 25.9 Finite State Machine Specification 376
- 25.10 Embedding Commands In A TELNET Data Stream 377
- 25.11 Option Negotiation 378
- 25.12 Request/Offer Symmetry 378
- 25.13 TELNET Character Definitions 378
- 25.14 A Finite State Machine For Data From The Server 380
- 25.15 Transitions Among States 380
- 25.16 A Finite State Machine Implementation 382
- 25.17 A Compact FSM Representation 383
- 25.18 Keeping The Compact Representation At Run-Time 384
- 25.19 Implementation Of A Compact Representation 385
- 25.20 Building An FSM Transition Matrix 386
- 25.21 The TCP Output Finite State Machine 388
- 25.22 Definitions For The TCP 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 393
- 25.27 The Heart Of The TELNET Client 395
- 25.28 Implementation Of The Main FSM 400
- 25.29 Summary 401
- For Further Study 401
- Exercises 402
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 408
- 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 411
- 26.11 Responding To DO/DONT For The Terminal Type Option 413
- 26.12 Option Subnegotiation 414
- 26.13 Sending Terminal Type Information 415
- 26.14 Terminating Subnegotiation 417
- 26.15 Sending A Character To The Server 417
- 26.16 Displaying Incoming Data On The User's Terminal 419
- 26.17 Using Termcap To Control The User's Terminal 423
- 26.18 Writing A Block Of Data To The Server 424
- 26.19 Interacting With The Client Process 426
- 26.20 Responding To Illegal Commands 426
- 26.21 Scripting To A File 427
- 26.22 Implementation Of Scripting 427
- 26.23 Initialization Of Scripting 428
- 26.24 Collecting Characters Of The Script File Name 429
- 26.25 Opening A Script File 430
- 26.26 Terminating Scripting 432
- 26.27 Printing Status Information 433
- 26.28 Summary 434
- For Further Study 434
- Exercises 435
Chapter 27 Practical Hints And Techniques For UNIX Servers
- 27.1 Introduction 437
- 27.2 Operating In Background 437
- 27.3 Programming A Server To Operate In Background 438
- 27.4 Open Descriptors And Inheritance 439
- 27.5 Programming A Server To Close Inherited Descriptors 440
- 27.6 Signals From The Controlling TTY 440
- 27.7 Process Groups And Sessions 440
- 27.8 Programming A Server To Change Its TTY And Session 441
- 27.9 Moving To A Safe And Known Directory 441
- 27.10 Programming A Server To Change Directories 442
- 27.11 The UNIX Umask 442
- 27.12 Programming A Server To Set Its Umask 443
- 27.13 Descriptors For Standard I/O 443
- 27.14 Programming A Server To Open Standard Descriptors 443
- 27.15 Mutual Exclusion For The Server 444
- 27.16 Programming A Server To Avoid Multiple Copies 444
- 27.17 Recording A Server's Process ID 445
- 27.18 Programming A Server To Record Its Process ID 445
- 27.19 Waiting For A Child Process To Exit 446
- 27.20 Programming A Server To Wait For Each Child To Exit 446
- 27.21 Extraneous Signals 446
- 27.22 Programming A Server To Ignore Extraneous Signals 446
- 27.23 Using A System Log Facility 447
- 27.23.1 Generating Log Messages 447
- 27.23.2 The Advantage Of Indirection And Standard Error 447
- 27.23.3 Limitations Of I/O Redirection 448
- 27.23.4 A Client-Server Solution 448
- 27.23.5 The Syslog Mechanism 448
- 27.23.6 Syslog Message Classes 449
- 27.23.7 Syslog Facilities 449
- 27.23.8 Syslog Priority Levels 450
- 27.23.9 Using Syslog 450
- 27.23.10 An Example Syslog Configuration File 451
- 27.24 Summary 452
- For Further Study 452
- Exercises 453
- For Further Study 486
- Exercises 486
Bibliography
Index