Chapter 61: Sockets: Advanced Topics

This chapter considers a range of more advanced topics relating to sockets programming, including the following:
  • the circumstances in which partial reads and writes can occur on stream sockets;
  • the use of shutdown() to close one half of the bidirectional channel between two connected sockets;
  • the recv() and send() I/O system calls, which provide socket-specific functionality not available with read() and write();
  • the sendfile() system call, which is used in certain circumstances to efficiently output data on a socket;
  • details of the operation of the TCP protocol, with the aim of eliminating some common misunderstandings that lead to mistakes when writing programs that use TCP sockets;
  • the use of the netstat and tcpdump commands for monitoring and debugging applications that use sockets; and
  • the use of the getsockopt() and setsockopt() system calls to retrieve and modify options affecting the operation of a socket.
We also consider a number of other more minor topics, and conclude the chapter with a summary of some advanced sockets features.

61 Sockets: Advanced Topics
61.1 Partial Reads and Writes on Stream Sockets
61.2 The shutdown() system call
61.3 Socket-specific I/O System Calls: recv() and send()
61.4 The sendfile() System Call
61.5 Retrieving Socket Addresses: getsockname() and getpeername()
61.6 A Closer Look at TCP
        61.6.1 Format of a TCP Segment
        61.6.2 TCP Sequence Numbers and Acknowledgements
        61.6.3 TCP State Machine and State Transition Diagram
        61.6.4 TCP Connection Establishment
        61.6.5 TCP Connection Termination
        61.6.6 Calling shutdown() on a TCP Socket
        61.6.7 The TIME_WAIT State
61.7 Monitoring Sockets: netstat
61.8 Using tcpdump to Monitor TCP Traffic
61.9 Socket Options: setsockopt() and getsockopt()
61.10 The SO_REUSEADDR Socket Option
61.11 Inheritance of File Flags and Socket Options across accept()
61.12 TCP Versus UDP
61.13 Advanced Features
        61.13.1 Out-of-band Data
        61.13.2 The sendmsg() and recvmsg() System Calls
        61.13.3 Passing File Descriptors
        61.13.4 Receiving Sender Credentials
        61.13.5 Sequenced-packet Sockets
        61.13.6 SCTP and DCCP Transport-layer Protocols
61.14 Summary
61.15 Exercises

No comments:

Post a Comment