
| TCP/IP 网络互连技术系列的第III卷讨论客户/服务器编程和应用,讲述了构筑所有分布式计算系统的客户/服务器计算模型的基本概念,内容包括各种不同的服务器设计方法,以及用来构造客户/服务器的各种工具和技术,包括远程调用RPC。书中包括了用来说明各种设计和工具的运行程序示例的源代码。卷III 有三个版本:BSD 套接字版,AT&T TLI版,Windows Sockets版。本书系Windows Sockets 版,讨论在Internet 上应用软件通过TCP/IP 进行通信的问题,适用于Windows 95,Windows NT,Win32 环境下编程和适用Windows Socket API 应用编程接口。 |
| contents foreword preface chapter 1 introduction and overview 1.1 use of tcp/ip 1.2 designing applications for a distributed environment 1.3 standard and nonstandard application protocol use 1.4 an example of standard application protocol use 1.5 an example connection 1.6 using telnet to access an alternative service 1.7 application protocols and software flexibility 1.8 viewing services from the provider's perspective 1.9 the remainder of this text 1.10 summary chapter 2 the client server model and software design 2.1 introduction 2.2 motivation 2.3 terminology and concepts 2.3.1 clients and servers .2.3.2 privilege and complexity 2.3.3 standard vs.nonstandard client software 2.3.4 parameterization of clients 2.3.5 connectionless vs.connection-oriented servers 2.3.6 stateless vs.stateful servers 2.3.7 a stateful file server example 2.3.8 statelessness is a protocol issue 2.3.9 severs as clients 2.4 summary chapter 3 concurrent processing in client-server software 3.1 introduction 3.2 concurrency in networks 3.3 concurrency in servers 3.4 terminology and concepts 3.4.1 the process concept 3.4.2 threads 3.4.3 programs vs.threads 3.4.4 procedure calls 3.5 an example of concurrent process creation 3.5.1 a sequential c example 3.5.2 a concurrent version 3.5.3 timeslicing 3.6 executing new code 3.7 context switching and protocol software design 3.8 concurrency and asynchronous i /o 3.9 summary chapter 4 program interface to protocols 4.1 introduction 4.2 loosely specified protocol software interface 4.2.1 advantages and disadvantages 4.3 interface functionality 4.4 conceptual interface specification 4.5 system calls 4.6 two basic approaches to network communication 4.7 the basic i/o functions available in unix 4.8 using unix i/o with tcp/ip 4.9 summary chapter 5 the socket interface 5.1 introduction 5.2 berkeley sockets 5.3 specifying a protocol interface 5.4 the socket abstraction 5.4.1 socket descriptors 5.4.2 system data structures for sockets 5.4.3 using sockets 5.5 specifying an endpoint address 5.6 a generic address structure 5.7 major system calls used with sockets 5.7.1 the wsastartup function 5.7.2 the wsacleanup function 5.7.3 the socket function 5.7.4 the connect function 5.7.5 the send function 5.7.6 the recv function 5.7.7 the closescket function 5.7.8 the bind function 5.7.9 the listen unction 5.7.10 the accept function 5.7.11 summary of socket calls used with tcp 5.8 utility routines for integer conversion 5.9 using socket calls in a program 5.10 symbolic constants for socket call parameters 5.11 summary chapter 6 algorithms and issues in client software design 6.1 introduction 6.2 learning algorithms instead of details 6.3 client architecture 6.4 identifying the location of a server 6.5 parsing an address argument 6.6 looking up a domain name 6.7 looking up a well-known port by name 6.8 port numbers and network byte order 6.9 looking up a protocol by name 6.10 the tcp client algorithm 6.11 allocating a socket 6.12 choosing a local protocol port number 6.13 a fundamental problem in choosing a local ip address 6.14 connecting a tcp socket to a server 6.15 communicating with the server using tcp 6.16 reading a response from a tcp connection 6.17 closing a tcp connection 6.17.1 the need for partial close 6.17.2 a partial close operation 6.18 programming a udp client 6.19 connected and unconnected udp sockets 6.20 using connect with udp 6.21 communicating with a server using udp 6.22 closing a socket that uses udp 6.23 partial close for udp 6.24 a warning about udp unreliability 6.25 summary chapter 7 example client software 7.1 introduction 7.2 the importance of small examples 7.3 hiding details 7.4 an example procedure library for client programs 7.5 implementation of connecttcp 7.6 implementation of connected 7.7 a procedure that forms connections 7.8 using the example library 7.9 the daytime service 7.10 implementation of a tcp client for daytime 7.11 reading from a tcp client for daytime 7.12 the time service 7.13 accessing the time service 7.14 accurate times and network delays 7.15 a udp client for the time service 7.16 the echo service 7.17 a tcp client for the echo service 7.18 a tcp client for the echo service 7.19 summary chapter 8 algorithms and lssues in server software design 8.1 introduction 8.2 the conceptual server algorithm 8.3 concurrent vs.iterative servers 8.4 connection-oriented vs.connectionless access 8.5 connection-oriented servers 8.6 connectionless servers 8.7 failure,reliability,and statelessness 8.8 optimizing stateless servers 8.9 four basic types of servers 8.10 request processing time 8.11 iterative server algorithms 8.12 an iterative,connection-oriented server algorithm 8.13 binding to a well-known address using inaddr-any 8.14 placing the socket in passive mode 8.15 acceptin connections and using them 8.16 an iterative,connectionless server algorithm 8.17 forming a reply address in a connectionless server 8.18 concurrent server algorithms 8.19 master and slave processes 8.20 a concurrent,connectionless server algorithm 8.21 a concurrent,connection-oriented server algorithm 8.22 using separate programs as slaves 8.23 apparent concurrency using a single process 8.24 when to use each server type 8.25 a summary of server types 8.26 the important problem of server deadlock 8.27 alternative implementations 8.28 summary chapter 9 iterative,connectionless servers(udp) 9.1 introduction 9.2 creating a passive socket 9.3 process structure 9.4 an example time server 9.5 summary chapter 10 iterative,connection-oriented servers(tcp) 10.1 introduction 10.2 allocating a passive tcp socket 10.3 a server for the daytime service 10.4 process structure 10.5 an example daytime server 10.6 closing connections 10.7 connection termination and server vulnerability 10.8 summary chapter 11 concurrent ,connection-oriented servers(tcp) 11.1 introduction 11.2 concurrent echo 11.3 iterative vs.concurrent implementations 11.4 process structure 11.5 an example concurrent echo server 11.6 cleaning up errant processes 11.7 summary chapter 12 single--process,concurrent servers(tcp) 12.1 introduction 12.2 data-driven processing in a server 12.3 data-drivenprocessing with a single process 12.4 process structure of a single-process server 12.5 an example single-process echo server 12.6 summary chapter 13 multiprotocol servers(tcp,udp) 13.1 introduction 13.2 the motivation for reducing the number of servers 13.3 multiprotocol server design 13.4 process structure 13.5 an example multiprotocol daytime server 13.6 the concept of shared code 13.7 concurrent multiprotocol servers 13.8 summary chapter 14 mulitiservice servers(tcp,udp) 14.1 introduction 14.2 consolidation servers 14.3 a connectionless,multiservice server design 14.4 a connection-oriented,multiservice server design 14.5 a concurrent,connection-oriented,multiservice server 14.6 a single-process,multiservice server implementation 14.7 invoking separate programs from a multiservice server 14.8 multiservice,multiprotocol designs 14.9 an example multiservice server 14.10 static and dynamic server configuration 14.11 the unix super server,inetd 14.12 an example inetd server 14.13 summary chapter 15 uniform,efficient management of server concurrency 15.1 introduction 15.2 choosing between an iterative and a concurrent design 15.3 level of concurrency 15.4 demand-driven concurrency 15.5 the cost of concurrency 15.6 overhead and delay 15.7 small delays can matter 15.8 process percolation 15.8.1 percolation techniques 15.8.2 percolation in a connection-oriented server 15.8.3 percolation in a connectionless server 15.8.4 percolation burst traffic ,and nfs 18.8.5 preallocation on a multiprocessor 15.9 delayed process allocation 15.10 the uniform basis for both techniques 15.11 combining techniques 15.12 summary chapter 16 concurrency in clients 16.1 introduction 16.2 the advantages of concurrency 16.3 the motivation for exercising control 16.4 concurrent contact with multiple servers 16.5 implementing concurrent clients 16.6 single-process implementations 16.7 an example concurrent client that uses echo 16.8 execution of the concurrent client 16.9 concurrency in the example code 16.10 summary chapter 17 tunneling at the transport and application levels 17.1 introduction 17.2 multiprotocol environments 17.3 mixing network technologies 17.4 dynamic circuit allocation 17.5 encapsulation and tunneling 17.6 tunneling through an ip internet 17.7 application-level tunneling between clients and servers 17.8 tunneling,encapsulation,and dialup phone lines 17.9 summary chapter 18 application level gateways 18.1 introduction 18.2 clients and servers in constrained environments 18.2.1 the reality of multiple technologies 18.2.2 computers with limited functionality 18.2.3 connectivity constraintsthat aries from security 18.3 using application gateways 18.4 interoperability through a mail gateway 18.5 implementation of a mail gateway 18.6 a comparison of application gateways and tunneling 18.7 application gateways and limited functionality systems 18.8 application gateways used for security 18.9 application gateways and the extra hop problem 18.10 an example application gateway 18.11 implementation of an application gateway 18.12 code for the application gateway 18.13 an example gateway exchange 18.14 using rfd with unix's forward 18.15 a general-purpose application gateway 18.16 operation of slurp 18.17 how slurp handles connections 18.18 ip a dressing and slurp 18.19 summary chapter 19 external data representation(xdr) 19.1 introduction 19.2 representations for data in computers 19.3 the n-squared conversion problem 19.4 network standard byte order 19.5 a de facto standard external data representation 19.6 xdr data types 19.7 implicit types 19.8 software support for using xdr 19.9 xdr library routines 19.10 building a message one piece at a time 19.11 conversion routines in the xdr library 19.12 xdr streams,i/o,and tcp 19.13 records,record boundaries,and datagram i/o 19.14 summary chapter 20 remote procedure call concept(rpc) 20.1 introduction 20.2 remote procedure call model 20.3 two paradigms for building distributed programs 20.4 a conceptual model for conventional procedure calls 20.5 an extension of the procedural model 20.6 execution of conventional procedure call and return 20.7 the procedural model in distributed systems 20.8 analogy between client-server and rpc 20.9 distributed computation as a program 20.10 sun microsystems'remote procedure call defamation 20.11 remote programs and procedures 20.12 reducing the number of arguments 20.13 identifying remote programs and procedures 20.14 accommodation multiple versions of a remote program 20.15 mutual exclusion for procedures in a remote program 20.16 communication semantics 20.17 at least once semantics 20.18 rpc retransmission 20.19 mapping a remote program to a remote procedure 20.20 dynamic port mapping 20.21 rpc port mapped algorithm 20.22 rpc message format 20.23 marshaling arguments for a remote procedure 20.24 authentication 20.25 an example of rpc message representation 20.26 an example of the unix authentication field 20.27 summary chapter 21 distributed program generation(rpcgen concept) 21.1 introduction 21.2 using rremote procedure calls 21.3 programming mechanisms to support rpc 21.4 dividing a program into local and remote procedures 21.5 adding code for rpc 21.6 stub procedures 21.7 multiple remote procedures and dispatching 21.8 name of the client-side stub procedure 21.9 using rpcgen to generate distributed programs 21.10 rpcgen output and interface procedures 21.11 rpcgen input and interface procedures 21.12 using remote to build a client and server 21.13 summary chapter 22 distributed program generation (rpcgen example) 22.1 introduction 22.2 an example to illustrate rpcgen 22.3 dictionary look up 22.4 eight steps to a distributed application 22.5 step 1 :build a conventional application program 22.6 step 1:dived the program into two parts 22.7 step 2:create an rrpcgen specification 22.8 step 4:run rpcgen 22.9 the .h file produced by rpcgen 22.10 the xdr conversion file produced by rpcgen 22.11 the client code produced by rpcgen 22.12 the server code produced by rpcgen 22.13 step 5:write stub interface procedures 22.13.1 client-side interface routines 22.13.2 server-side interface routines 22.14 step 6:compile and link the client program 22.15 step 7:compile and link the server program 22.16 step 8:start the link the server program 22.17 using the unix make utility 22.18 summary chapter 23 network file system concepts(nfs) 23.1 introduction 23.2 remote file access vs.transfer 23.3 operations on remote files 23.4 file access among heterogeneous computers 23.5 stateless servers 23.6 nfs and unix file semantics 23.7 review of the unix file system 23.7.1 basic definitions 23.7.2 a byte sequence without record boundaries 23.7.3 a file's owner and group identifiers 23.7.4 protection and access 23.7.5 the unix open-read-write-close paradigm 23.7.6 unix data transfer 23.7.7 permission to search a directory 23.7.8 unix random access 23.7.9 seeking beyond the end of a unix file 23.7.10 unix file position and concurrent access 23.7.11 semantics of write during concurrent access 23.7.12 unix file names and paths 23.7.13 the unix inode:information stored with a file 23.7.14 the unix stat operation 23.7.15 the unix file naming mechanism 23.7.16 unix file system mounts 23.7.17 unix file name resolution 23.7.18 unix symbolic links 23.8 files under nfs 23.9 nfs file types 23.10 nfs file modes 23.11 nfs file attributes 23.12 nfs client and server 23.13 nfs client operation 23.14 nfs client and unix 23.15 nfs mounts 23.16 file handle 23.17 handles replace path names 23.18 an nfs client in unix 23.19 file positioning with a stateless server 23.20 operations on directories 23.21 reading a directory statelessly 23.22 multiple hierarchies in an nfs server 23.23 the mount protocol 23.24 summery chapter d24 network file system protocol(nfs,mount) 24.1 introduction 24.2 using rpc to define a protocol 24.3 defining a protocol with data structures and procedures 24.4 nfs constant,type ,and data declarations 24.4.1 nfs constants 24.4.2 nfs typedef declarations 24.4.3 nfs data structures 24.5 nfs procedures 24.6 semantics of nfs operations 24.6.1 nfsproc_null 24.6.2 nfsproc_getattr 24.6.3 nfsproc_setattr 24.6.4 nfsproc_root 24.6.5 nfsproc_lookup 24.6.6 nfsproc_readlink 24.6.7 nfsproc_read 24.6.8 nfsproc_writecache 24.6.9 nfsproc_write 24.6.10 nfsproc_create 24.6.11 nfsproc_remove 24.6.12 nfsproc_rename 24.6.13 nfsproc_link 24.6.14 nfsproc_symlink 24.6.15 nfsproc_mkdir 24.6.16 nfsproc_rmdir 24.6.17 nfsproc_readdir 24.6.18 nfsproc_statfs 24.7 the mount protocol 24.7.1 mount constant definitions 27.4.2 mount type definitions 27.7.3 mount data structures 24.8 procedures in the mount protocol 24.9 semantics of mount operations 24.9.1 mntproc_null 24.9.2 mntproc_mnt 24.9.3 mntproc_dump 24.9.4 mntproc_umnt 24.9.5 mntproc_umntall 24.9.6 mntproc_export 24.10 nfs and mount authentication 24.11 changes in nfs version 3 24.12 summary chapter 25 a telnet client (program structure) 25.1 introduction 25.2 overview 25.2.1 the user's terminal 25.2.2 command and control information 25.2.3 terminals,windows ,and files 25.2.4 the need for concurrency 25.2.5 a thread modest for a telnet client 25.3 a telnet client algorithm 25.4 terminal i/o in unix 25.5 establishing terminal modes 25.6 global variable used for stored state 25.7 restoring terminal modes before exit 25.8 client suspension and resumption 25.9 finite state machine specification 25.10 embedding commands in a telnet data stream 25.11 option negotiation 25.12 request/offer symmetry 25.13 telnet character definitions 25.14 a finite state machine for data from the server 25.15 transitions among states 25.16 a finite state machine implementation 25.17 a compact fsm representation 25.18 keeping the compact representatin at run-time 25.19 implementation of a compact representation 25.20 building an fsm transition machine 25.21 the socket output finite state machine 25.22 definitions for the socket output fsm 25.23 the option subnegotiation finite state machine 25.24 definitions for the option subnegotiation fsm 25.25 fsm initialization 25.26 arguments for the telnet client 25.27 the heart of the telnet client 25.28 implementation of the main fsm 25.29 summary chapter 26 a telnet client (implementation details) 26.1 introduction 26.2 the fsm action procedures 26.3 recording the type of an option request 26.4 performing no operation 26.5 responding to will/wont for the echo option 26.6 responding to will/wont for unsupported options 26.7 responding to will/wont for the no go-ahead option 26.8 generating do/dont for binary transmission 26.9 responding to do/dont for unsupported options 26.10 responding to do/dont for transmit binary option 26.11 responding to do/dont for the terminal type option 26.12 option subnegotiation 26.13 sending terminal type information 26.14 terminating subnegotiation 26.15 sending a character to the server 26.16 displaying incoming data on the user's terminal 26.17 using tarmac to control the user's terminal 26.18 writing a block of data to the server 26.19 interacting with the client process 26.20 responding to illegal commands 26.21 scripting to a file 26.22 implementation of scripting 26.23 initialization of scripting 26.24 collecting characters of the script file name 26.25 opening a script file 26.26 terminating scripting 26.27 pruning status information 26.28 summary chapter 27 practical hints and techniques for unix servers 27.1 introduction 27.2 operation in gakground 27.3 progranuning a server to operate in background 27.4 open descriptors and inheritance 27.5 programming a server to close inherited descriptors 27.6 signals from the controlling tty 27.7 programming a server to change its controlling tty 27.1 generation log messages 27.8 moving to a safe and known directory 27.9 programming a server to change directories 27.10 the unix unmask 27.11 programming a server to set its unmask 27.12 process groups 27.13 programming a server to set its pooches group 27.14 descriptors for standard i/o 27.15 programming a server to open standard descriptors 27.16 mutual exclusion for the server 27.17 programming a server to avoid multiple copies 27.18 recording a server's process id 27.19 programming a server to record its process id 27.20 waiting for a child process to exit 27.21 programming a server to wait for each child to exit 27.22 extremes sigma's 27.23 programming a server to ignore extremes signals 27.24 using a system log facility 27.25 summary chapter 28 deadlock and starvation in client-server systems 28.1 introduction 28.2 definition of deadlock 28.3 difficulty of deadlock detection 28.4 deadlock avoidance 28.5 deadlock between a client and server 28.6 avoiding deadlock in a single interaction 28.7 starvation among a set of clients and a server 28.8 busy connections and starvation 28.9 avoiding blocking operations 28.10 processes,connections,and other limits 28.11 cycles of clients and servers 28.12 documenting dependencies 28.13 summary appendix 1 system calls and library routines used with sockets appendix 2 manipulation of unix file and socket descriptors bibliography index |
商品评论(0条)