logo
分类于: 互联网 职场办公

简介

UNIX网络编程 卷1

UNIX网络编程 卷1 9.8分

资源最后更新于 2020-09-04 14:37:36

作者:Richard Stevens

出版社:人民邮电出版社

出版日期:2009-01

ISBN:9787115215093

文件格式: pdf

标签: 网络编程 unix 网络 计算机 经典 Linux 编程 计算机-网络

简介· · · · · ·

《UNIX网络编程 卷1:套接字联网API(英文版 第3版)》是一部UNIX网络编程的经典之作。书中全面深入地介绍了如何使用套接字API进行网络编程。全书不但介绍了基本编程内容,还涵盖了与套接字编程相关的高级主题,对于客户/服务器程序的各种设计方法也作了完整的探讨,最后还深入分析了流这种设备驱动机制。

《UNIX网络编程 卷1:套接字联网API(英文版 第3版)》内容详尽且具权威性,几乎每章都提供精选的习题,并提供了部分习题的答案,是网络研究和开发人员理想的参考书。

想要: 点击会收藏到你的 我的收藏,可以在这里查看

已收: 表示已经收藏

Tips: 注册一个用户 可以通过用户中心得到电子书更新的通知哦

目录

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 the text 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
索引 ...