도서 정보
도서 상세설명
1 Introduction 1
1.1 Networks, Packets, and Protocols 1
1.2 About Addresses 4
1.2.1 Writing Down IP Addresses 4
1.2.2 Dealing with Two Versions 5
1.2.3 Port Numbers 5
1.2.4 Special Addresses 6
1.3 About Names 7
1.4 Clients and Servers 7
1.5 What Is a Socket? 8
2 Basic TCP Sockets 11
2.1 IPv4 TCP Client 11
2.2 IPv4 TCP Server 17
2.3 Creating and Destroying Sockets 22
2.4 Specifying Addresses 23
2.4.1 Generic Addresses 23
2.4.2 IPv4 Addresses 24
2.4.3 IPv4 Addresses 24
2.4.4 Generic Address Storage 25
2.4.5 Binary/String Address Conversion 26
2.4.6 Getting a Socket\'s Associated Addresses 26
2.5 Connecting a Socket 27
2.6 Binding to an Address 27
2.7 Handling Incoming Connections 28
2.8 Communication 30
2.9 Using IPv6 30
3 Of Names and Address Families 35
3.1 Mapping Names to Numbers 35
3.1.1 Accessing the Name Service 36
3.1.2 Details, Details 40
3.2 Writing Address-Generic Code 41
3.2.1 Generic TCP Client 43
3.2.2 Generic TCP Server 46
3.2.3 IPv4-IPv6 Interoperation 49
3.3 Getting Names from Numbers 50
4 Using UDP Sockets 53
4.1 UDP Client 54
4.2 UDP Server 57
4.3 Sending and Receiving with UDP Sockets 60
4.4 Connecting a UDP Socket 61
5 Sending and Receiving Data 63
5.1 Encoding Integers 64
5.1.1 Sizes of Integers 64
5.1.2 Byte Ordering 66
5.1.3 Signedness and Sign Extension 67
5.1.4 Encoding Integers by Hand 68
5.1.5 Wrapping TCP Sockets in Streams 71
5.1.6 Structure Overlays: Alignment and Padding 73
5.1.7 Strings and Text 76
5.1.8 Bit-Diddling: Encoding Booleans 78
5.2 Constructing, Framing, and Parsing Messages 79
5.2.1 Framing 86
5.2.2Text-Based Message Encoding 91
5.2.3 Binary Message Encoding 94
5.2.4 Putting It All Together 96
5.3 Wrapping Up 97
6 Beyond Basic Socket Programming 99
6.1 Socket Options 99
6.2 Signals 100
6.3 Nonblocking I/O 106
6.3.1 Nonblocking Sockets 107
6.3.2 Asynchronous I/O 108
6.3.3 Timeouts 112
6.4 Multitasking 116
6.4.1 Per-Client Processes 117
6.4.2 Per-Client Thread 123
6.4.3 Constrained Multitasking 126
6.5 Multiplexing 128
6.6 Multiple Recipients 133
6.6.1 Broadcast 134
6.6.2 Multicast 137
6.6.3 Broadcast vs. Multicast 142
7 Under the Hood 143
7.1 Buffering and TCP 145
7.2 Deadlock Danger 148
7.3 Performance Implications 149
7.4 TCP Socket Life Cycle 150
7.4.1 Connecting 150
7.4.2 Closing a TCP Connection 154
7.5 Demultiplexing Demystified 158
8 Socket Programming in C++ 161
8.1 PracticalSocket Library Overview 162
8.2 Plus One Service 164
8.2.1 Plus One Server 164
8.2.2 Plus One Client 166
8.2.3 Running Server and Client 168
8.3 Survey Service 168
8.3.1 Survey Support Functions 169
8.3.2 Survey Server 172
8.3.3 Survey Client 176
8.3.4 Running Server and Client 178
8.4 Survey Service, Mark 2 178
8.4.1 Socket Address Support 179
8.4.2 Socket Iostream Interface 180
8.4.3 Enhanced Survey Server 181
8.4.4 Enhanced Survey Client 186
8.4.5 Administrative Client 187
8.4.6 Running Server and Clients 188