Skimpy coverage, the code compiles with a bazillion warnings, and for me at least the first client/server examples just plain don't work and don't provide useful enough error messages to figure out. It's not until you get to a much later chapter that you learn about debugging techniques that *might
The Definitive Guide to Linux Network Programming (Expert's Voice)
β Scribed by Keir Davis, John Turner, Nathan Yocom
- Publisher
- Apress
- Year
- 2004
- Tongue
- English
- Leaves
- 402
- Edition
- 1
- Category
- Library
No coin nor oath required. For personal study only.
β¦ Synopsis
Apress' The Definitive Guide to Linux Network Programming is a clear, concise treatment of creating clients and servers under the Linux operating system. The book assumes that the reader knows C and has experience developing code on Linux, but provides everything else a programmer needs for real-world network programming, including design, implementation, debugging, and security. Readers will learn about the many kinds of socket types, sessioned vs. sessionless protocols, how to build a custom protocol, encryption, how to use SSL, and how to tunnel data.
β¦ Table of Contents
Prelims......Page 1
Contents at a Glance......Page 7
Contents......Page 9
Introduction......Page 19
Circuits vs. Packets......Page 27
Internetworking......Page 28
Ethernets......Page 30
Ethernet Frames......Page 31
Ethernet Addresses......Page 32
Gateways......Page 34
Internet Addresses......Page 36
Internet Protocol......Page 41
Protocol Layering......Page 44
Protocol Layer Models......Page 46
User Datagram Protocol......Page 49
Transmission Control Protocol......Page 51
The Client-Server Model......Page 55
The Domain Name System......Page 57
Summary......Page 63
What Is a Socket?......Page 65
Using Sockets......Page 67
Socket Constants......Page 68
Address Structure......Page 71
Using Socket Functions......Page 73
Summary......Page 87
User Datagram Protocol......Page 89
UDP Server......Page 90
UDP Client......Page 94
File Transfer......Page 97
The Server......Page 98
The Client......Page 103
Example File Transfer Session......Page 106
Error Handling......Page 107
Summary......Page 108
State vs. Stateless......Page 109
Methods for Maintaining State......Page 111
Storing State on the Server......Page 112
Storing State on the Client......Page 114
Stateless Server Walk-through......Page 117
Stateful Server Walk-through......Page 118
Summary......Page 120
Client Test Program......Page 123
The select() Function......Page 126
A Multiplexing Server......Page 128
Forking......Page 132
One Process Per Client......Page 133
Preforking: Process Pools......Page 138
Multithreading......Page 142
A Multithreaded Server......Page 143
Combining Preforking and Prethreading......Page 152
Nonblocking Sockets......Page 154
Putting It All Together......Page 156
Summary......Page 159
What Is a Protocol?......Page 161
What Will the Message Format Be?......Page 162
Will the Server Be Passive or Active?......Page 163
Will the Protocol Be Sessioned or Sessionless?......Page 164
What About Privacy?......Page 165
Client Commands......Page 166
Server Messages......Page 170
Our Chat Protocol in Action......Page 173
The /etc/services File......Page 174
Service Entry Functions......Page 175
Summary......Page 177
Reliability......Page 179
Overhead......Page 180
Established vs. Custom......Page 181
Two-Tier Architecture......Page 182
Three-Tier Architecture......Page 183
Monolithic Client......Page 185
Server-Side Considerations......Page 186
Daemonizing......Page 187
Logging......Page 189
Privilege Dropping......Page 192
chroot() Jails......Page 195
Summary......Page 196
netstat......Page 197
Ethereal......Page 198
gdb......Page 200
Chicken or the Egg......Page 201
Debug Statements......Page 202
Respect Buffer Limits......Page 203
Expect the Unexpected......Page 205
Fail Gracefully, But Not Silently......Page 206
Summary......Page 207
The Server......Page 209
The Client......Page 225
chatcli.h......Page 227
chatcli.cpp......Page 228
logindlg.h......Page 233
logindlg.cpp......Page 234
chatwin.h......Page 235
chatwin.cpp......Page 236
Makefile......Page 249
Recommendations for Improvements......Page 250
Summary......Page 251
Securing Network Communication......Page 255
Tunneling......Page 256
Tunneling with OpenSSH......Page 257
Tunneling with Stunnel......Page 258
Symmetric Key Cryptography......Page 259
Asymmetric Key Cryptography......Page 260
Certificates......Page 261
OpenSSL Functions and Structures......Page 266
File Descriptor Association......Page 272
BIO Connection Handling......Page 277
Thread-safe Programming with OpenSSL......Page 279
Compiling and Running the Example......Page 283
Summary......Page 284
The Old Scenario......Page 285
The Present-Day Scenario......Page 286
The Conversation Function......Page 287
Creating a PAM-Aware Application......Page 290
Public Key Authentication......Page 292
Using Signed Data for Authentication......Page 293
Single Sign-on......Page 302
Summary......Page 303
Common Attacks......Page 305
Functions to Avoid and Their Alternatives......Page 306
Error Handling......Page 310
Memory Management......Page 312
Worst-Case Scenarios......Page 316
Shared Memory and Variable Scope......Page 317
Random Number Generation......Page 320
Compiler Add-ons......Page 321
Code Analysis Tools......Page 322
Summary......Page 323
Process Method......Page 325
Security Model......Page 326
The Protocol......Page 327
Common Code Library......Page 328
The Client......Page 342
The Server......Page 351
Running the Client and Server......Page 358
Flawfinder Audit......Page 359
Future Improvements and Enhancements......Page 360
Summary......Page 363
IPv6......Page 365
IPv6 Addressing......Page 366
IPv6 and Linux......Page 368
Porting to IPv6......Page 369
IPv6 Server......Page 371
IPv6 Client......Page 374
Address Conversion Functions......Page 376
Future Enhancements......Page 378
Summary......Page 382
Index......Page 385
π SIMILAR VOLUMES
Apress' The Definitive Guide to Linux Network Programming is a clear, concise treatment of creating clients and servers under the Linux operating system. The book assumes that the reader knows C and has experience developing code on Linux, but provides everything else a programmer needs for real-wor
<p><p><i>The Definitive Guide to Linux Network Programming</i> offers a clear, concise treatment of creating clients and servers under the Linux operating system. This book assumes that you know C and have experience developing code on Linux, but it provides everything else you'll need as a programm
<p>This book is the ultimate reference for both beginners and power users to PC-BSDβthe free, easy-to-use operating system based on FreeBSD. Existing power users will learn how to look under the hood and contribute to the global PC-BSD community. PC-BSD is turning into a hassle-free alternative to L