logo
  人民邮电出版社  
     
     
   
  首页 | 关于我们 | 新闻 | 分类检索 | 丛书检索 | 高级检索 | 招聘 | 读者交流卡 | 用户注册 | 用户登录
高级查询
分类查询
丛书查询
浏览图书
查看图书详情
单击可查看完整封面
书名: UNIX网络编程 卷1:套接字联网API(英文版•第3版)
评论星级:
书号: 978-7-115-21509-3
原书名: Unix Network Programming, Volume 1: The Sockets Networking API
原出版社: Addison-Wesley
丛书名: 图灵原版计算机科学系列
分类: 计算机 >> 网络与通信
计算机 >> 操作系统 >> UNIX
作者: W.Richard Stevens, Bill Fenner, Andrew M. Rudoff
译者:
出版日期: 2009-11-11
语种: 简体中文
开本: 16开
页数: 1016
定价: 129.00 元人民币
 
Part 1 Introduction and TCP/IP    1
简介和TCP/IP
Chapter 1 Introduction    3
简介
1.1 Introduction    3
概述
1.2 A Simple Daytime Client    6
一个简单的时间获取客户程序
1.3 Protocol Independence    10
协议无关性
1.4 Error Handling: Wrapper Functions    11
错误处理:包装函数
1.5 A Simple Daytime Server    13
一个简单的时间获取服务器程序
1.6 Roadmap to Client/Server Examples in theText    16
本书中客户/服务器示例的路线图
1.7 OSI Model    18
OSI模型
1.8 BSD Networking History    20
BSD网络历史
1.9 Test Networks and Hosts    22
测试用网络及主机
1.10 Unix Standards    25
Unix标准
1.11 64-Bit Architectures    28
64位体系结构
1.12 Summary    29
小结
Chapter 2 The Transport Layer: TOP,UDP, and SCTP    31
传输层:TCP、UDP和SCTP
2.1 Introduction    31
概述
2.2 The Big Picture    32
全景图
2.3 User Datagram Protocol (UDP)    34
用户数据报协议
2.4 Transmission Control Protocol (TCP)    35
传输控制协议
2.5 Stream Control Transmission Protocol(SCTP)    36
流控制传输协议
2.6 TCP Connection Establishment andTermination    37
TCP连接的建立和终止
2.7 TIME_WAIT State    43
TIME_WAIT状态
2.8 SCTP Association Establishment andTermination    44
SCTP关联的建立和终止
2.9 Port Numbers    50
端口号
2.10 TCP Port Numbers and ConcurrentServers    52
TCP端口号与并发服务器
2.11 Buffer Sizes and Limitations    55
缓冲区大小及限制
2.12 Standard Internet Services    61
标准因特网服务
2.13 Protocol Usage by Common InternetApplications    62
常见因特网应用所用的协议
2.14 Summary    63
小结
Part 2 Elementary Sockets    65
基本套接字
Chanter 3 Sockets Introduction    67
套接字简介
3.1 Introduction    67
概述
3.2 Socket Address Structures    67
套接字地址结构
3.3 Value-Result Arguments    74
值-结果参数
3.4 Byte Ordering Functions    77
字节排序函数
3.5 Byte Manipulation Functions    80
字节操纵函数
3.6 inet_aton, inet_addr, and inet_ntoa Functions    82
inet_aton、inet_addr和inet_ntoa函数
3.7 inet_pton and inet_ntop Functions    83
inet_pton和inet_ntop函数
3.8 sock_ntop and Related Functions    86
sock_ntop和相关函数
3.9 readn, writen, and readline Functions    88
readn、writen和readline函数
3.10 Summary    92
小结
Chapter 4 Elementary TCP Sockets    95
基本TCP套接字
4.1 Introduction    95
概述
4.2 socket Function    95
socket函数
4.3 connect Function    99
connect函数
4.4 bind Function    101
bind函数
4.5 listen Function    104
listen函数
4.6 accept Function    109
accept函数
4.7 fork and exec Functions    111
fork和exec函数
4.8 Concurrent Servers    114
并发服务器
4.9 close Function    117
close函数
4.10 getsockname and getpeernameFunctions    117
getsockname和getpeername函数
4.11 Summary    120
小结
Chapter 5 TCP Client/Server Example    121
TCP客户/服务器示例
5.1 Introduction    121
概述
5.2 TCP Echo Server: main Function    122
TCP回送服务器程序:main函数
5.3 TCP Echo Server: str_echo Function    123
TCP回送服务器程序:str_echo函数
5.4 TCP Echo Client: main Function    124
TCP回送客户程序:main函数
5.5 TCP Echo Client: str_cli Function    125
TCP回送客户程序:str_cli函数
5.6 Normal Startup    126
正常启动
5.7 Normal Termination    128
正常终止
5.8 POSIX Signal Handling    129
POSIX信号处理
5.9 Handling SIGCHLD Signals    132
处理SIGCHLD信号
5.10 wait and waitpid Functions    135
wait和waitpid函数
5.11 Connection Abort before acceptReturns    139
accept返回前连接异常中止
5.12 Termination of Server Process    141
服务器进程的终止
5.13 SIGPIPE Signal    142
SIGPIPE信号
5.14 Crashing of Server Host    144
服务器主机崩溃
5.15 Crashing and Rebooting of Server Host    144
服务器主机崩溃及重启
5.16 Shutdown of Server Host    145
服务器主机关机
5.17 Summary of TCP Example    146
TCP示例小结
5.18 Data Format    147
数据格式
5.19 Summary    151
小结
Chapter 6 I/O Multiplexing: The select and poll Functions    153
I/O多路复用:select和poll函数
6.1 Introduction    153
概述
6.2 I/O Models    154
I/O模型
6.3 select Function    160
select函数
6.4 str_cli Function (Revisited)    167
再访str_cli函数
6.5 Batch Input and Buffering    169
批量输入和缓冲
6.6 shutdown Function    172
shutdown函数
6.7 str_cli Function (Revisited Again)    173
三顾str_cli函数
6.8 TCP Echo Server (Revisited)    175
再访TCP回送服务器程序
6.9 pselect Function    181
pselect函数
6.10 poll Function    182
poll函数
6.11 TCP Echo Server (Revisited Again)    185
三顾TCP回送服务器程序
6.12 Summary    188
小结
Chapter 7 Socket Options    191
套接字选项
7.1 Introduction    191
概述
7.2 getsockopt and setsockopt Functions    192
getsockopt和setsockopt函数
7.3 Checking if an Option Is Supported and Obtaining the Default    194
检查选项是否被支持并获取默认值
7.4 Socket States    198
套接字状态
7.5 Generic Socket Options    198
通用套接字选项
7.6 IPv4 Socket Options    214
IPv4套接字选项
7.7 ICMPv6 Socket Option    216
ICMPv6套接字选项
7.8 IPv6 Socket Options    216
IPv6套接字选项
7.9 TCP Socket Options    219
TCP套接字选项
7.10 SCTP Socket Options    222
SCTP套接字选项
7.11 fcntl Function    233
fcntl函数
7.12 Summary    236
小结
Chapter 8 Elementary UDP Sockets    239
基本UDP套接字
8.1 Introduction    239
概述
8.2 recvfrom and sendto Functions    240
recvfrom和sendto函数
8.3 UDP Echo Server: main Function    241
UDP回送服务器程序:main函数
8.4 UDP Echo Server: dg_echo Function    242
UDP回送服务器程序:dg_echo函数
8.5 UDP Echo Client: main Function    244
UDP回送客户程序:main函数
8.6 UDP Echo Client: dg_cli Function    245
UDP回送客户程序:dg_cli函数
8.7 Lost Datagrams    245
数据报的丢失
8.8 Verifying Received Response    246
验证接收到的响应
8.9 Server Not Running    248
服务器程序未运行
8.10 Summary of UDP Example    250
UDP示例小结
8.11 connect Function with UDP    252
UDP的connect函数
8.12 dg_cli Function (Revisited)    256
再论dg_cli函数
8.13 Lack of Flow Control with UDP    257
UDP缺乏流量控制
8.14 Determining Outgoing Interface with UDP    261
UDP中的外出接口的确定
8.15 TCP and UDP Echo Server Using select    262
使用select函数的TCP和UDP回送服务器程序
8.16 Summary    264
小结
Chapter 9 Elementary SCTP Sockets    267
基本SCTP套接字
9.1 Introduction    267
概述
9.2 Interface Models    268
接口模型
9.3 sctp_bindx Function    272
sctp_bindx函数
9.4 sctp_connectx Function    274
sctp_connectx函数
9.5 sctp_getpaddrs Function    275
sctp_getpaddrs函数
9.6 sctp_freepaddrs Function    275
sctp_freepaddrs函数
9.7 sctp_getladdrs Function    275
sctp_getladdrs函数
9.8 sctp_freeladdrs Function    276
sctp_freeladdrs函数
9.9 sctp_sendmsg Function    276
sctp_sendmsg函数
9.10 sctp_recvmsg Function    277
sctp_recvmsg函数
9.11 sctp_opt_info Function    278
sctp_opt_info函数
9.12 sctp_peeloff Function    278
sctp_peeloff函数
9.13 shutdown Function    278
shutdown函数
9.14 Notifications    280
通知
9.15 Summary    286
小结
Chapter 10 SCTP Client/Server Example    287
SCTP客户/服务器示例
10.1 Introduction    287
概述
10.2 SCTP One-to-Many-Style Streaming Echo Server: main Function    288
SCTP一到多式流分回送服务器程序:main函数
10.3 SCTP One-to-Many-Style Streaming Echo Client: main Function    290
SCTP一到多式流分回送客户程序:main函数
10.4 SCTP Streaming Echo Client: str_cli Function    292
SCTP流分回送客户程序:str_cli函数
10.5 Exploring Head-of-Line Blocking    293
探究头端阻塞
10.6 Controlling the Number of Streams    299
控制流的数目
10.7 Controlling Termination    300
控制终止
10.8 Summary    301
小结
Chapter 11 Name and Address Conversions    303
名字与地址转换
11.1 Introduction    303
概述
11.2 Domain Name System (DNS)    303
域名系统
11.3 gethostbyname Function    307
gethostbyname函数
11.4 gethostbyaddr Function    310
gethostbyaddr函数
11.5 getservbyname and getservbyport Functions    311
getservbyname和getservbyport函数
11.6 getaddrinfo Function    315
getaddrinfo函数
11.7 gai_strerror Function    320
gai_strerror函数
11.8 freeaddrinfo Function    321
freeaddrinfo函数
11.9 getaddrinfo Function: IPv6    322
getaddrinfo函数:IPv6
11.10 getaddrinfo Function: Examples    324
getaddrinfo函数:示例
11.11 host_serv Function    325
host_serv函数
11.12 tcp_connect Function    326
tcp_connect函数
11.13 tcp_listen Function    330
tcp_listen函数
11.14 udp_client Function    334
udp_client函数
11.15 udp_connect Function    337
udp_connect函数
11.16 udp_server Function    338
udp_server函数
11.17 getnameinfo Function    340
getnameinfo函数
11.18 Re-entrant Functions    341
可重入函数
11.19 gethostbyname_r and gethostbyaddr_r Functions    344
gethostbyname_r和gethostbyaddr_r函数
11.20 Obsolete IPv6 Address Lookup Functions    346
废弃的IPv6地址解析函数
11.21 Other Networking Information    348
其他联网信息
11.22 Summary    349
小结
Part 3 Advanced Sockets    351
高级套接字
Chapter 12 IPv4 and IPv6 Interoperability    353
IPv4与IPv6的互操作性
12.1 Introduction    353
概述
12.2 IPv4 Client, IPv6 Server    354
IPv4客户与IPv6服务器
12.3 IPv6 Client, IPv4 Server    357
IPv6客户与IPv4服务器
12.4 IPv6 Address-Testing Macros    360
IPv6地址测试宏
12.5 Source Code Portability    361
源代码可移植性
12.6 Summary    362
小结
Chapter 13 Daemon Processes and the inetd Superserver    363
守护进程和inetd超级服务器程序
13.1 Introduction    363
概述
13.2 syslogd Daemon    364
syslogd守护进程
13.3 syslog Function    365
syslog函数
13.4 daemon_init Function    367
daemon_init函数
13.5 inetd Daemon    371
inetd守护进程
13.6 daemon_inetd Function    377
daemon_inetd函数
13.7 Summary    379
小结
Chapter 14 Advanced I/O Functions    381
高级I/O函数
14.1 Introduction    381
概述
14.2 Socket Timeouts    381
套接字超时
14.3 recv and send Functions    387
recv和send函数
14.4 readv and writev Functions    389
readv和writev函数
14.5 recvmsg and sendmsg Functions    390
recvmsg和sendmsg函数
14.6 Ancillary Data    395
辅助数据
14.7 How Much Data Is Queued?    398
排队的数据量
14.8 Sockets and Standard I/O    399
套接字和标准I/O
14.9 Advanced Polling    402
高级轮询技术
14.10 Summary    408
小结
Chapter 15 Unix Domain Protocols    411
Unix域协议
15.1 Introduction    411
概述
15.2 Unix Domain Socket Address Structure    412
Unix域套接字地址结构
15.3 socketpair Function    414
socketpair函数
15.4 Socket Functions    415
套接字函数
15.5 Unix Domain Stream Client/Server    416
Unix域流客户/服务器
15.6 Unix Domain Datagram Client/Server    418
Unix域数据报客户/服务器
15.7 Passing Descriptors    420
描述符传递
15.8 Receiving Sender Credentials    429
接收发送者的凭证
15.9 Summary    432
小结
Chapter 16 Nonblocking I/O    435
非阻塞I/O
16.1 Introduction    435
概述
16.2 Nonblocking Reads and Writes: str_cli Function (Revisited)    437
非阻塞读和写:再论str_cli函数
16.3 Nonblocking connect    448
非阻塞connect
16.4 Nonblocking connect: Daytime Client    449
非阻塞connect:时间获取客户程序
16.5 Nonblocking connect: Web Client    452
非阻塞connect:Web客户程序
16.6 Nonblocking accept    461
非阻塞accept
16.7 Summary    463
小结
Chapter 17 ioctl Operations    465
ioctl操作
17.1 Introduction    465
概述
17.2 ioctl Function    466
ioctl函数
17.3 Socket Operations    466
套接字操作
17.4 File Operations    468
文件操作
17.5 Interface Configuration    468
接口配置
17.6 get_ifi_info Function    469
get_ifi_info函数
17.7 Interface Operations    480
接口操作
17.8 ARP Cache Operations    481
ARP高速缓存操作
17.9 Routing Table Operations    483
路由表操作
17.10 Summary    484
小结
Chapter 18 Routing Sockets    485
路由套接字
18.1 Introduction    485
概述
18.2 Datalink Socket Address Structure    486
数据链路套接字地址结构
18.3 Reading and Writing    487
读和写
18.4 sysctl Operations    495
sysctl操作
18.5 get_ifi_info Function (Revisited)    500
get_ifi_info函数
18.6 Interface Name and Index Functions    504
接口名字和索引函数
18.7 Summary    508
小结
Chapter 19 Key Management Sockets    511
密钥管理套接字
19.1 Introduction    511
概述
19.2 Reading and Writing    512
读和写
19.3 Dumping the Security Association Database (SADB)    514
安全关联数据库的转储
19.4 Creating a Static Security Association (SA)    517
创建静态安全关联
19.5 Dynamically Maintaining SAs    524
动态维护安全关联
19.6 Summary    528
小结
Chapter 20 Broadcasting    529
广播
20.1 Introduction    529
概述
20.2 Broadcast Addresses    531
广播地址
20.3 Unicast versus Broadcast    532
单播和广播的比较
20.4 dg_cli Function Using Broadcasting    535
使用广播的dg_cli函数
20.5 Race Conditions    538
竞争状态
20.6 Summary    547
小结
Chapter 21 Multicasting    549
多播
21.1 Introduction    549
概述
21.2 Multicast Addresses    549
多播地址
21.3 Multicasting versus Broadcasting on a LAN    553
局域网上多播和广播的比较
21.4 Multicasting on a WAN    556
广域网上的多播
21.5 Source-Specific Multicast    558
源特定多播
21.6 Multicast Socket Options    559
多播套接字选项
21.7 mcast_join and Related Functions    565
mcast_join和相关函数
21.8 dg_cli Function Using Multicasting    570
使用多播的dg_cli函数
21.9 Receiving IP Multicast Infrastructure Session Announcements    571
接收IP多播基础设施会话声明
21.10 Sending and Receiving    575
发送和接收
21.11 Simple Network Time Protocol (SNTP)    579
简单网络时间协议
21.12 Summary    584
小结
Chapter 22 Advanced UDP Sockets    587
高级UDP套接字
22.1 Introduction    587
概述
22.2 Receiving Flags, Destination IP Address, and Interface Index    588
接收标志、目的IP地址和接口索引
22.3 Datagram Truncation    594
数据报截断
22.4 When to Use UDP Instead of TCP    594
何时用UDP代替TCP
22.5 Adding Reliability to a UDP Application    597
给UDP应用增加可靠性
22.6 Binding Interface Addresses    608
绑定接口地址
22.7 Concurrent UDP Servers    612
并发UDP服务器
22.8 IPv6 Packet Information    615
IPv6分组信息
22.9 IPv6 Path MTU Control    618
IPv6路径MTU控制
22.10 Summary    620
小结
Chapter 23 Advanced SCTP Sockets    621
高级SCTP套接字
23.1 Introduction    621
概述
23.2 An Autoclosing One-to-Many-Style Server    621
自动关闭的一到多式服务器程序
23.3 Partial Delivery    622
部分递送
23.4 Notifications    625
通知
23.5 Unordered Data    629
无序的数据
23.6 Binding a Subset of Addresses    630
绑定地址子集
23.7 Determining Peer and Local Address Information    631
确定对端和本端地址信息
23.8 Finding an Association ID Given an IP Address    635
给定IP地址找出关联ID
23.9 Heartbeating and Address Failure    636
心搏和地址不可达
23.10 Peeling Off an Association    637
关联剥离
23.11 Controlling Timing    639
定时控制
23.12 When to Use SCTP Instead of TCP    641
何时用SCTP代替TCP
23.13 Summary    643
小结
Chapter 24 Out-of-Band Data    645
带外数据
24.1 Introduction    645
概述
24.2 TCP Out-of-Band Data    645
TCP带外数据
24.3 sockatmark Function    654
sockatmark函数
24.4 TCP Out-of-Band Data Recap    661
TCP带外数据小结
24.5 Summary    662
小结
Chapter 25 Signal-Driven I/O    663
信号驱动I/O
25.1 Introduction    663
概述
25.2 Signal-Driven I/O for Sockets    664
套接字的信号驱动I/O
25.3 UDP Echo Server Using SIGIO    666
使用SIGIO的UDP回送服务器程序
25.4 Summary    672
小结
Chapter 26 Threads    675
线程
26.1 Introduction    675
概述
26.2 Basic Thread Functions: Creation and Termination    676
基本线程函数:创建和终止
26.3 str_cli Function Using Threads    679
使用线程的str_cli函数
26.4 TCP Echo Server Using Threads    681
使用线程的TCP回送服务器程序
26.5 Thread-Specific Data    686
线程特定数据
26.6 Web Client and Simultaneous Connections (Continued)    694
Web客户与同时连接(续)
26.7 Mutexes: Mutual Exclusion    697
互斥锁
26.8 Condition Variables    701
条件变量
26.9 Web Client and Simultaneous Connections (Continued)    705
Web客户与同时连接(续)
26.10 Summary    707
小结
Chapter 27 IP Options    709
IP选项
27.1 Introduction    709
概述
27.2 IPv4 Options    709
IPv4选项
27.3 IPv4 Source Route Options    711
IP源路径选项
27.4 IPv6 Extension Headers    719
IPv6扩展首部
27.5 IPv6 Hop-by-Hop Options and Destination Options    719
IPv6步跳选项和目的选项
27.6 IPv6 Routing Header    725
IPv6路由首部
27.7 IPv6 Sticky Options    731
IPv6粘附选项
27.8 Historical IPv6 Advanced API    732
历史性IPv6高级API
27.9 Summary    733
小结
Chapter 28 Raw Sockets    735
原始套接字
28.1 Introduction    735
概述
28.2 Raw Socket Creation    736
原始套接字创建
28.3 Raw Socket Output    737
原始套接字输出
28.4 Raw Socket Input    739
原始套接字输入
28.5 ping Program    741
ping程序
28.6 traceroute Program    755
traceroute程序
28.7 An ICMP Message Daemon    769
一个ICMP消息守护进程
28.8 Summary    786
小结
Chapter 29 Datalink Access    787
数据链路访问
29.1 Introduction    787
概述
29.2 BSD Packet Filter (BPF)    788
BSD分组过滤器
29.3 Datalink Provider Interface (DLPI)    790
数据链路提供者接口
29.4 Linux: SOCK_PACKET and PF_PACKET    791
Linux:SOCK_PACKET和PF_PACKET
29.5 libpcap: Packet Capture Library    792
libpcap:分组捕获函数库
29.6 libnet: Packet Creation and Injection Library    793
libnet:分组构造与注入函数库
29.7 Examining the UDP Checksum
Field    793
检查UDP的校验和字段
29.8 Summary    815
小结
Chapter 30 Client/Server Design Alternatives    817
多种客户/服务器设计方式
30.1 Introduction    817
概述
30.2 TCP Client Alternatives    819
各种TCP客户程序设计方式
30.3 TCP Test Client    820
TCP测试用客户程序
30.4 TCP Iterative Server    821
TCP迭代服务器程序
30.5 TCP Concurrent Server, One Child per Client    822
TCP并发服务器程序,每个客户一个子进程
30.6 TCP Preforked Server, No Locking Around accept    826
TCP预先派生子进程服务器程序,accept无上锁保护
30.7 TCP Preforked Server, File Locking Around accept    832
TCP预先派生子进程服务器程序,accept使用文件上锁保护
30.8 TCP Preforked Server, Thread Locking Around accept    835
TCP预先派生子进程服务器程序,accept使用线程上锁保护
30.9 TCP Preforked Server, Descriptor Passing    836
TCP预先派生子进程服务器程序,传递描述符
30.10 TCP Concurrent Server, One Thread per Client    842
TCP并发服务器程序,每个客户一个线程
30.11 TCP Prethreaded Server, per-Thread accept    844
TCP预先创建线程服务器程序,每个线程各自accept
30.12 TCP Prethreaded Server, Main Thread accept    846
TCP预先创建线程服务器程序,主线程统一accept
30.13 Summary    849
小结
Chapter 31 STREAMS    851
31.1 Introduction    851
概述
31.2 Overview    851
概貌
31.3 getmsg and putmsg Functions    856
getmsg和putmsg函数
31.4 getpmsg and putpmsg Functions    857
getpmsg和putpmsg函数
31.5 ioctl Function    857
ioctl函数
31.6 Transport Provider Interface (TPI)    858
传输提供者接口
31.7 Summary    868
小结
Appendix A IPv4, IPv6, ICMPv4, and ICMPv6    869
IPv4、IPv6、ICMPv4和ICMPv6
A.1 Introduction    869
概述
A.2 IPv4 Header    869
IPv4首部
A.3 IPv6 Header    871
IPv6首部
A.4 IPv4 Addresses    874
IPv4地址
A.5 IPv6 Addresses    877
IPv6地址
A.6 Internet Control Message Protocols (ICMPv4 and ICMPv6)    882
因特网控制消息协议(ICMPv4和ICMPv6)
Appendix B Virtual Networks    885
虚拟网络
B.1 Introduction    885
概述
B.2 The MBone    885
B.3 The 6bone    887
B.4 IPv6 Transition: 6to4    889
IPv6过渡:6to4
Appendix C Debugging Techniques    891
调试技术
C.1 System Call Tracing    891
系统调用跟踪
C.2 Standard Internet Services    893
标准因特网服务
C.3 sock Program    893
sock程序
C.4 Small Test Programs    896
小测试程序
C.5 tcpdump Program    896
tcpdump程序
C.6 netstat Program    896
netstat程序
C.7 lsof Program    897
lsof程序
Appendix D Miscellaneous Source Code    899
其他源代码
D.1 unp.h Header    899
unp.h头文件
D.2 config.h Header    904
config.h头文件
D.3 Standard Error Functions    910
标准错误处理函数
Appendix E Solutions to SelectedExercises    913
精选习题答案
Bibliography    947
参考文献
Index    955
索引
关于我们广告服务联系我们招聘信息法律公告用户反馈会员注册教师登记网站地图
Copyright © 2005 北京图灵文化发展有限公司 All Rights Reserved
地址:北京市朝阳区北苑路13号院1号楼领地OFFICE C座603室 100107
电话:010-510951815109518251095183 传真:010-52086950 E-mail:contact@turingbook.com
京ICP备06005389号