Set options associated with a socket
Synopsis:
#include <sys/types.h>
#include <sys/socket.h>
int setsockopt( int s,
                int level,
                int optname, 
                const void * optval,
                socklen_t optlen );
Arguments:
- s
- The file descriptor of the socket that the option is to be applied on,
  as returned by 
  socket().
- level
- The protocol layer that the option is to be applied to.
  In most cases, it's a socket-level option and is indicated by SOL_SOCKET.
- optname
- The option for the socket file descriptor.
- optval
- A pointer to the value that you want to set the option to.
  In most cases, the value indicates whether the option is to be turned
  on (nonzero) or off (zero). 
  
  
  
  
  Most socket-level options use an int parameter for optval. 
  Others, such as the SO_LINGER,
  SO_SNDTIMEO,
  and 
  SO_RCVTIMEO
  options, use structures that also let you get data associated with
  the option.
   
- optlen
- The length of the value for the option, in bytes.
Library:
libsocket
Use the -l socket option to
qcc
to link against this library.
Description:
The setsockopt() function sets the options associated with a socket.
See 
getsockopt()
for more detailed information.
Returns:
- 0
- Success.
- -1
- An error occurred (errno is set).
Errors:
- EBADF
- Invalid file descriptor s.
- EDOM
- Value was set out of range.
- EFAULT
- The address pointed to by optval isn't in a
  valid part of the process address space.
- EINVAL
- No optval value was specified, or the size of the value is invalid.
- ENOPROTOOPT
- The option is unknown at the level indicated.
- EOPNOTSUPP
- You tried to set the SO_TXPRIO option, but you didn't specify the
  so_txprio_enable option when you started
  io-pkt.
  
  
  
Classification:
POSIX 1003.1
| Safety: |  | 
|---|
| Cancellation point | No | 
| Interrupt handler | No | 
| Signal handler | Yes | 
| Thread | Yes |