s
A socket descriptor created by the socket() function.
level
The protocol level for which the socket options are to be
modified. It can have one of the following values:
SOL_SOCKET Set the options at the socket level.
p Any protocol number. Set the options for
protocol level p. For IPv4, see the IN.H
header file for the IPPROTO values. For IPv6,
see the IN6.H header file for the IPPROTO_IPV6
values.
optname
Interpreted by the protocol specified in level. Options at each
protocol level are documented with the protocol.
Refer to:
o Socket Options for a list of socket options
o TCP Protocol Options for a list of TCP options
o IP Protocol Options for a list of IP options
optval
Points to a buffer containing the arguments of the specified
option.
All socket-level options other than SO_LINGER should be nonzero
if the option is to be enabled, or zero if it is to be disabled.
SO_LINGER uses a linger structure argument defined in the
SOCKET.H header file. This structure specifies the desired state
of the option and the linger interval. The option value for the
SO_LINGER command is the address of a linger structure.
If the socket is type SOCK_STREAM, which promises the reliable
delivery of data, and l_onoff is nonzero, the system blocks the
process on the close() attempt until it is able to transmit the
data or until it decides it is unable to deliver the information.
A timeout period, called the linger interval, is specified in l_
linger.
If l_onoff is set to zero and a close() is issued, the system
processes the close in a manner that allows the process to
continue as soon as possible.
optlen
An integer specifying the size of the buffer pointed to by
optval.