Establishes parameters for socket operation.
#include <sys/socket.h> int setsockopt ( int s, int level, int optname, const void *optval, size_t optlen);
(IN) Specifies the socket file handle for which parameters are to be established.
(IN) Specifies the protocol level at which the option resides with one of the following flags:
(IN) Specifies the option for the request. See one of the following:
(IN) Points to the location for the option value.
(IN) Specifies the length of the option.
If successful, returns 0. Otherwise, returns -1 and sets errno to one of the following:
Options exist at either the socket level or the underlying protocol level (see sys/ socket.h for socket-level option definitions). When setting socket options, you must specify the name of the option and the level at which it resides:
To set options at the socket level, specify level as SOL_SOCKET.
To set options at the protocol level, supply the number of the underlying protocol controlling the option.
For example, for IPv4 and IPv6 protocol families, if you want TCP to interpret an option, set the level to IPPROTO_TCP.