Knowing that the size of the sending and receiving buffers for the default socket are quite large, you as an application designer might decide that a smaller set of buffers might be more appropriate. This might be especially significant if you are expecting several instances of the program to run on your system.
Options are set on sockets using the setsockopt(2) function. Its function prototype is given as follows:
int setsockopt(int s,
const void *optval,
This function closely resembles the getsockopt(2) function discussed earlier. The arguments for setsockopt(2) are listed as follows:
- The socket s to effect an option change upon.
- The socket level of the option.
- The option optname to set.
- The pointer optval to the value to be used for the new option value.
- The option value length optlen, in bytes.
The only real difference between this function's arguments and the getsockopt(2) argument list is that the last argument is passed by value only. It is an input value only in this case.
See Also:IPC Advance Socket Concepts and Example Codes