TCP/IP Programming Manual
Errors
If an error occurs, the external variable errno is set to one the following values:
The specified option is unknown to the protocol.ENOPROTOOPT
An invalid argument was specified.EINVAL
Usage Guidelines
• Use setsockopt on a socket created for waited operations, or setsockopt_nw on a socket
created for nowait operations. The operation initiated by P/setsockopt_nw must be
completed with a call to the AWAITIOX procedure.
• When a packet is sent from an application to a broadcast address, the packet is received by
the local host unless a duplicate packet is also sent to the loopback address.
• When you call the setsockopt or setsockopt_nw function for UDP sockets, the
SO_BROADCAST option must be specified if you want to send a broadcast packet.
• If packets larger than the default values need to be sent or received, specify the appropriate
size in the SO_SNDBUF and SO_RCVBUF socket options, respectively. The following table
summarizes the default values for each subsystem:
NonStop TCP/IPv6Parallel Library TCP/IPNonStop TCP/IP
61,440 bytes8,192 bytes8,192 bytesSO_SNDBUF TCP Default
9,216 bytes9,216 bytes9,216 bytesSO_SNDBUF UDP Default
42,080 bytes41,600 bytes20,800 bytesSO_RCVBUF UDP Default
The maximum values for these two options for NonStop TCP/IP and Parallel Library TCP/IP
is 262,144 bytes. The maximum value for these two options for NonStop TCP/IPv6 is
1,048,576 bytes. (Anything over 32,767 must be passed using the wide model.) An
interprocess transfer is restricted to 32,000 bytes for NonStop TCP/IP and to 57,344 bytes
for Parallel Library TCP/IP and NonStop TCP/IPv6. Refer to the discussion of WRITEREAD[X]
in the Guardian Procedure Calls Reference Manual for more information.
• Applications can use the SETSOCKOPT call options to alter, on an individual TCP socket basis,
the TCP retransmission timer variables.
• All time values used for the socket library calls are in 500 millisecond ticks.
• If the TCP maximum retransmission count (TCP_RXMTCNT) multiplied by the TCP maximum
retransmission timeout (TCP_MAXRXMT) is lower than the total maximum TCP retransmission
duration, the TCP connection is dropped sooner than the duration value.
• The TCP_MAXRXMT value should be set to be greater (or at least equal too) the TCP_MINRXMT
value.
• Socket options for incoming connections that are accepted with a call to accept_nw2 should
not be set until the accept_nw2 call completes. Any socket options that are set prior to the
call to accept_nw2 are lost.
See Nowait Call Errors (page 86) for information on error checking. See also Dropping Membership
in a Multicast Group (page 61).
Examples
See UDP Client Program (page 219) for examples that call the setsockopt routine.
188 Library Routines