The socket's properties and its behavior can be configured by changing the values of its various options. When the socket object is instantiated, its options have default values. In many cases, the socket configured by default is a perfect fit, whereas in others, it may be needed to fine tune the socket by changing values of its options so that it meets the requirements of the application.
In this recipe, we will see how to get and set socket options with Boost.Asio.
This recipe assumes familiarity with the content provided in Chapter 1, The Basics.
Each socket option, whose value can be set or obtained by means of a functionality provided by Boost.Asio, is represented by a separate class. The complete list of classes that represent setting or getting socket options, which are supported by Boost.Asio, can be found on this Boost.Asio documentation page at http://www.boost.org/doc/libs/1_58_0/doc/html/boost_asio/reference/socket_base...