7.1 Introduction
There are various ways to get and set the
options that affect a socket:
This chapter starts by covering the
setsockopt and getsockopt functions, followed by
an example that prints the default value of all the options, and
then a detailed description of all the socket options. We divide
the detailed descriptions into the following categories: generic,
IPv4, IPv6, TCP, and SCTP. This detailed coverage can be skipped
during a first reading of this chapter, and the individual sections
referred to when needed. A few options are discussed in detail in a
later chapter, such as the IPv4 and IPv6 multicasting options,
which we will describe with multicasting in Section
21.6.
We also describe the fcntl function,
because it is the POSIX way to set a socket for nonblocking I/O,
signal-driven I/O, and to set the owner of a socket. We save the
ioctl function for Chapter 17.
|