What is SOL_SOCKET used for?

c, network-programming, sockets

Solution

`SOL_SOCKET` is the socket layer itself. It is used for options that are protocol independent.

You can read more here.

Problem

As it is stated in the Linux `man` page Use this constant as the level argument to `getsockopt` or `setsockopt` to manipulate the socket-level options described in this section But I don't get this explanation. What is the purpose of `SOL_SOCKET`? What does it do?

Original source