Socket Options - Socket Programming - setsockopt - getsockoptSocket Options - Socket Programming - setsockopt - getsockopt

Whenever we do user-space network socket programming let it be TCP, UDP or even Raw sockets, you can further configure and control these sockets via socket options. And you can do the same via setsockopt() API and get the configuration via getsockopt() API. The setsockopt() function provides an application program (user-space) with the means to control socket behavior. You can use setsockopt() to allocate buffer space, control timeouts, permit socket data broadcasts and so on. And these are some of the socket option names: SO_DEBUG, SO_BROADCAST, SO_REUSEADDR, SO_KEEPALIVE, SO_LINGER, SO_OOBINLINE, SO_SNDBUF, SO_RCVBUF, SO_DONTROUTE, SO_RCVLOWAT, SO_RCVTIMEO, SO_SNDLOWAT, SO_SNDTIMEO. The header defines the socket-level options available to setsockopt().

For more details about these APIs you can refer the API main page. For example as defined HERE.