getsockopt.2 (2010 09)

g
getsockopt(2) getsockopt(2)
be lowered using the ndd variable tcp_recv_hiwater_max) and UDP(7P)
(default buffer size: 2147483647 bytes; maximum buffer size: 2147483647
bytes; udp maximum receive buffer size can be lowered using the
ndd
parameter udp_recv_hiwater_max).
SO_REUSEADDR (int; boolean; AF_INET sockets only) If enabled, allows a local address
to be reused in subsequent calls to bind()
. Default: disallowed.
SO_REUSEPORT (int; boolean; AF_INET sockets only) If enabled, allows a local address
and port to be reused in subsequent calls to
bind(). Default: disal-
lowed.
SO_SNDBUF (int) Specifies the maximum size, in bytes, of the send socket buffer.
For SOCK_STREAM sockets, the send buffer size limits how much data
can be queued for transmission before the application is blocked. For
SOCK_DGRAM sockets, the send buffer size may limit the maximum size
of messages that the application can send through the socket.
Default and maximum values: protocol-dependent; see indivi-
dual protocol manual entries, such as TCP(7P) (default send buffer size:
32768 bytes; maximum send buffer size: 2147483647 bytes; maximum
buffer size can be lowered using the
ndd variable
tcp_xmit_hiwater_max) and UDP(7P) (default send buffer size: 65535
bytes; maximum send buffer size: 2147483647 bytes).
SO_TYPE (int) Returns the socket type.
SO_USELOOPBACK (int; boolean) Not used internally; provided only for compatibility.
Setting the
SO_BROADCAST option allows the application to send messages through the SOCK_DGRAM
socket to a broadcast destination address.
If
SO_DONTROUTE is set, the system does not use the network routing tables when determining which
interface to use to send an outbound message. Instead, the system sends the message through the inter-
face whose network address matches the network portion of the destination address. If SO_DONTROUTE
is not set (default), the system uses the network routing tables.
If
SO_KEEPALIVE is disabled (default), a TCP connection may remain idle until the connection is
released at the protocol layer. If SO_KEEPALIVE is enabled and the connection has been idle for two
hours, TCP sends a packet to the remote socket, expecting the remote TCP to acknowledge that the con-
nection is still active. If the remote TCP does not respond in a timely manner, TCP continues to send
keepalive packets according to the normal retransmission algorithm. If the remote TCP does not respond
within a particular time limit, TCP drops the connection. The next socket system call (for example,
recv()) returns an error, and errno is set to [ETIMEDOUT].
SO_LINGER controls the actions to be taken when there are untransmitted data in a SOCK_STREAM
send socket buffer when the socket is closed, either due to an explicit call to
close() or because the
application terminates normally or abnormally. The action is determined by the values of members of the
struct linger data structure pointed to by optval in a call to setsockopt(). The data type
struct linger is defined in <sys/socket.h>.Ifl_onoff is zero (the default action), close()
returns immediately, but the system tries to transmit any unsent data and release the protocol connection
gracefully. If l_onoff is non-zero and l_linger is zero, close() returns immediately, any unsent
data is discarded, and the protocol connection is aborted. If both l_onoff and l_linger are non-
zero, close() does not return until the system has tried to transmit all unsent data and release the
connection gracefully or until a protocol-defined time limit. Note that the value of l_linger is treated
simply as a boolean; a non-zero value is not interpreted as a time limit (see X/Open Sockets Only below).
SO_LINGER does not affect the actions taken when the function shutdown() is called.
If
SO_OOBINLINE is set, out-of-band data (TCP "urgent data") is left "in-line" among the normal data
stream. In that case, the SIOCATMARK ioctl() request must be used to determine if the inbound
data stream has been read up to the point where the out-of-band data begins. If multiple transmissions
of out-of-band data are received before the application reads them, all of the data is left in-line; however,
SIOCATMARK indicates the location of only the last transmission of out-of-band data. If
SO_OOBINLINE is not set (default), only one byte of out-of-band is saved. This byte is pulled out of the
normal data stream, and it is accessible only by setting MSG_OOB in the flags parameter when the appli-
cation reads the data (see recv(2)). In that case, if multiple transmissions of out-of-band data are
received before the application reads them, previous bytes of out-of-band data are lost.
HP-UX 11i Version 3: September 2010 3 Hewlett-Packard Company 3