UNIX網路編程卷1

UNIX網路編程卷1

《UNIX網路編程卷1》是2009年人民郵電出版社出版的圖書,作者是RichardStevens。本書中全面深入地介紹了如何使用套接字API進行網路編程等內容。

基本介紹

  • 書名:UNIX網路編程卷
  • 作者:Richard Stevens
  • ISBN:9787115215093
  • 頁數:991
  • 定價:129.00元
  • 出版社:人民郵電出版社
  • 出版時間:2009
  • 裝幀:平裝
內容介紹,作者介紹,作品目錄,

內容介紹

《UNIX網路編程 卷1:套接字聯網API(英文版 第3版)》是一部UNIX網路編程的經典之作。全書不但介紹了基本編程內容,還涵蓋了與套接字編程相關的高級主題,對於客戶/伺服器程式的各種設計方法也作了完整的探討,最後還深入分析了流這種設備驅動機制。
《UNIX網路編程 卷1:套接字聯網API(英文版 第3版)》內容詳盡且具權威性,幾乎每章都提供精選的習題,並提供了部分習題的答案,是網路研究和開發人員理想的參考書。

作者介紹

W. Richard Stevens(1951—1999) 國際知名的UNIX和網路專家,備受讚譽的技術作家。生前著有《TCP/IP詳解》(三卷)、《UNIX環境高級編程》和《UNIX網路編程》(兩卷),均為不朽的經典著作。
Bill Fenner AT&T實驗室的主要技術人員,專攻IP多播、網路管理和測量,他是IETF路由的領域主管之一,負責審批作為RFC出版的所有路由相關文檔。
Andrew M. Rudoff Sun公司的資深軟體工程師,專攻網路、作業系統核心、檔案系統和高可用性軟體體系結構。

作品目錄

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

相關詞條

熱門詞條

聯絡我們