z/OS Communications Server: IP Sockets Application Programming Interface Guide and Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


SETSOCKOPT

z/OS Communications Server: IP Sockets Application Programming Interface Guide and Reference
SC27-3660-00

The SETSOCKOPT macro sets the options associated with a socket.

The OPTVAL and OPTLEN parameters are used to pass data used by the particular set command. The OPTVAL parameter points to a buffer containing the data needed by the set command. The OPTLEN parameter must be set to the size of the data pointed to by OPTVAL.

The following requirements apply to this call:
Read syntax diagramSkip visual syntax diagram
>>-EZASMI--TYPE=SETSOCKOPT--,S--=--+-number---+----------------->
                                   +-address--+   
                                   +-*indaddr-+   
                                   '-(reg)----'   

>--,OPTLEN--=--+-address--+------------------------------------->
               +-*indaddr-+   
               '-(reg)----'   

>--,OPTNAME--=--+-'IP_ADD_SOURCE_MEMBERSHIP'--+----------------->
                +-'IP_BLOCK_SOURCE'-----------+   
                +-'IP_ADD_MEMBERSHIP'---------+   
                +-'IP_DROP_SOURCE_MEMBERSHIP'-+   
                +-'IP_DROP_MEMBERSHIP'--------+   
                +-'IP_MULTICAST_IF'-----------+   
                +-'IP_MULTICAST_LOOP'---------+   
                +-'IP_UNBLOCK_SOURCE'---------+   
                +-'IP_MULTICAST_TTL'----------+   
                +-'IPV6_ADDR_PREFERENCES'-----+   
                +-'IPV6_JOIN_GROUP'-----------+   
                +-'IPV6_LEAVE_GROUP'----------+   
                +-'IPV6_MULTICAST_HOPS'-------+   
                +-'IPV6_MULTICAST_IF'---------+   
                +-'IPV6_MULTICAST_LOOP'-------+   
                +-'IPV6_UNICAST_HOPS'---------+   
                +-'IPV6_V6ONLY'---------------+   
                +-'MCAST_BLOCK_SOURCE'--------+   
                +-'MCAST_JOIN_GROUP'----------+   
                +-'MCAST_JOIN_SOURCE_GROUP'---+   
                +-'MCAST_LEAVE_GROUP'---------+   
                +-'MCAST_LEAVE_SOURCE_GROUP'--+   
                +-'MCAST_UNBLOCK_SOURCE'------+   
                +-'SO_BROADCAST'--------------+   
                +-'SO_KEEPALIVE'--------------+   
                +-'SO_LINGER'-----------------+   
                +-'SO_OOBINLINE'--------------+   
                +-'SO_RCVBUF'-----------------+   
                +-'SO_RCVTIMEO'---------------+   
                +-'SO_REUSEADDR'--------------+   
                +-'SO_SNDBUF'-----------------+   
                +-'SO_SNDTIMEO'---------------+   
                +-'TCP_KEEPALIVE'-------------+   
                +-'TCP_NODELAY'---------------+   
                +-address---------------------+   
                +-*indaddr--------------------+   
                '-(reg)-----------------------'   

>--,OPTVAL--=--+-address--+--,ERRNO--=--+-address--+------------>
               +-*indaddr-+             +-*indaddr-+   
               '-(reg)----'             '-(reg)----'   

>--,RETCODE--=--+-address--+--+---------------------------+----->
                +-*indaddr-+  +-,ECB--=--+-address--+-----+   
                '-(reg)----'  |          +-*indaddr-+     |   
                              |          '-(reg)----'     |   
                              '-,REQAREA--=--+-address--+-'   
                                             +-*indaddr-+     
                                             '-(reg)----'     

>--+-------------------------+--+------------------------+-----><
   '-,ERROR--=--+-address--+-'  '-,TASK--=--+-address--+-'   
                +-*indaddr-+                +-*indaddr-+     
                '-(reg)----'                '-(reg)----'     

Keyword
Description
S
Input parameter. A value or the address of a halfword binary number specifying the socket descriptor of the socket requiring options.
OPTNAME
Input parameter. See the table below for a list of the options and their unique requirements. See GETSOCKOPT/SETSOCKOPT command values for the numeric values of OPTNAME.
OPTVAL
Input parameter. Contains data about the option specified in OPTNAME. See the table below for a list of the options and their unique requirements
OPTLEN
Input parameter. A fullword binary field containing the length of the data returned in OPTVAL. See the table below for determining on what to base the value of OPTLEN.
ERRNO
Output parameter. A fullword binary field. If RETCODE is negative, this field contains an error number. See Socket call error return codes for information about ERRNO return codes.
RETCODE
Output parameter. A fullword binary field that returns one of the following values:
Value
Description
0
Successful call.
-1
Check ERRNO for an error code.
ECB or REQAREA
Input parameter. This parameter is required if you are using APITYPE=3. It points to a 104-byte field containing:
For ECB
A 4-byte ECB posted by TCP/IP when the macro completes.
For REQAREA
A 4-byte user token (set by you) that is presented to your exit when the response to this function request is complete.
For ECB/REQAREA
The last 100 bytes is a storage field used by the interface to save the state information.
Note: This storage must not be modified until the macro function has completed and the ECB has been posted, or the asynchronous exit has been driven.
ERROR
Input parameter. The location in your program to receive control when the application programming interface (API) processing module cannot be loaded.
TASK
Input parameter. The location of the task storage area in your program.
Table 1. OPTNAME options for GETSOCKOPT and SETSOCKOPT
OPTNAME options (input) SETSOCKOPT, OPTVAL (input) GETSOCKOPT, OPTVAL (output)
IP_ADD_MEMBERSHIP

Use this option to enable an application to join a multicast group on a specific interface. An interface has to be specified with this option. Only applications that want to receive multicast datagrams need to join multicast groups.

This is an IPv4-only socket option.

Contains the IP_MREQ structure as defined in SYS1.MACLIB(BPXYSOCK). The IP_MREQ structure contains a 4-byte IPv4 multicast address followed by a 4-byte IPv4 interface address.

See SEZAINST(CBLOCK) for the PL/I example of IP_MREQ.

See SEZAINST(EZACOBOL) for the COBOL example of IP-MREQ.

N/A
IP_ADD_SOURCE_MEMBERSHIP

Use this option to enable an application to join a source multicast group on a specific interface and a specific source address. You must specify an interface and a source address with this option. Applications that want to receive multicast datagrams need to join source multicast groups.

This is an IPv4-only socket option.

Contains the IP_MREQ_SOURCE structure as defined in SYS1.MACLIB(BPXYSOCK). The IP_MREQ_SOURCE structure contains a 4-byte IPv4 multicast address followed by a 4-byte IPv4 source address and a 4-byte IPv4 interface address.

See SEZAINST(CBLOCK) for the PL/I example of IP_MREQ_SOURCE.

See SEZAINST(EZACOBOL) for the COBOL example of IP-MREQ-SOURCE.

N/A
IP_BLOCK_SOURCE

Use this option to enable an application to block multicast packets that have a source address that matches the given IPv4 source address. You must specify an interface and a source address with this option. The specified multicast group must have been joined previously.

This is an IPv4-only socket option.

Contains the IP_MREQ_SOURCE structure as defined in SYS1.MACLIB(BPXYSOCK). The IP_MREQ_SOURCE structure contains a 4-byte IPv4 multicast address followed by a 4-byte IPv4 source address and a 4-byte IPv4 interface address.

See SEZAINST(CBLOCK) for the PL/I example of IP_MREQ_SOURCE.

See SEZAINST(EZACOBOL) for the COBOL example of IP-MREQ-SOURCE.

N/A
IP_DROP_MEMBERSHIP

Use this option to enable an application to exit a multicast group or to exit all sources for a multicast group.

This is an IPv4-only socket option.

Contains the IP_MREQ structure as defined in SYS1.MACLIB(BPXYSOCK). The IP_MREQ structure contains a 4-byte IPv4 multicast address followed by a 4-byte IPv4 interface address.

See SEZAINST(CBLOCK) for the PL/I example of IP_MREQ.

See SEZAINST(EZACOBOL) for the COBOL example of IP-MREQ.

N/A
IP_DROP_SOURCE_MEMBERSHIP

Use this option to enable an application to exit a source multicast group.

This is an IPv4-only socket option.

Contains the IP_MREQ_SOURCE structure as defined in SYS1.MACLIB(BPXYSOCK). The IP_MREQ_SOURCE structure contains a 4-byte IPv4 multicast address followed by a 4-byte IPv4 source address and a 4-byte IPv4 interface address.

See SEZAINST(CBLOCK) for the PL/I example of IP_MREQ_SOURCE.

See SEZAINST(EZACOBOL) for the COBOL example of IP-MREQ-SOURCE.

N/A
IP_MULTICAST_IF

Use this option to set or obtain the IPv4 interface address used for sending outbound multicast datagrams from the socket application.

This is an IPv4-only socket option.

Note: Multicast datagrams can be transmitted only on one interface at a time.
A 4-byte binary field containing an IPv4 interface address. A 4-byte binary field containing an IPv4 interface address.
IP_MULTICAST_LOOP

Use this option to control or determine whether a copy of multicast datagrams is looped back for multicast datagrams sent to a group to which the sending host itself belongs. The default is to loop the datagrams back.

This is an IPv4-only socket option.

A 1-byte binary field.

To enable, set to 1.

To disable, set to 0.

A 1-byte binary field.

If enabled, will contain a 1.

If disabled, will contain a 0.

IP_MULTICAST_TTL

Use this option to set or obtain the IP time-to-live of outgoing multicast datagrams. The default value is '01'x meaning that multicast is available only to the local subnet.

This is an IPv4-only socket option.

A 1-byte binary field containing the value of '00'x to 'FF'x. A 1-byte binary field containing the value of '00'x to 'FF'x.
IP_UNBLOCK_SOURCE

Use this option to enable an application to unblock a previously blocked source for a given IPv4 multicast group. You must specify an interface and a source address with this option.

This is an IPv4-only socket option.

Contains the IP_MREQ_SOURCE structure as defined in SYS1.MACLIB(BPXYSOCK). The IP_MREQ_SOURCE structure contains a 4-byte IPv4 multicast address followed by a 4-byte IPv4 source address and a 4-byte IPv4 interface address.

See SEZAINST(CBLOCK) for the PL/I example of IP_MREQ_SOURCE.

See SEZAINST(EZACOBOL) for the COBOL example of IP-MREQ-SOURCE.

 
IPV6_ADDR_PREFERENCES

Use this option to query or set IPv6 address preferences of a socket. The default source address selection algorithm considers these preferences when it selects an IP address that is appropriate to communicate with a given destination address.

This is an AF_INET6-only socket option.

Result: These flags are only preferences. The stack could assign a source IP address that does not conform to the IPV6_ADDR_PREFERENCES flags that you specify.
Guideline: Use the INET6_IS_SRCADDR function to test whether the source IP address matches one or more IPV6_ADDR_PREFERENCES flags.
Contains the 4-byte flags field IPV6_ADDR_PREFERENCES_ FLAGS that is defined in SYS1.MACLIB(BPXYSOCK) with the following flags:
IPV6_PREFER_SRC_HOME (X'00000001')
Prefer home address
IPV6_PREFER_SRC_COA (X'00000002')
Prefer care-of address
IPV6_PREFER_SRC_TMP (X'00000004')
Prefer temporary address
IPV6_PREFER_SRC_PUBLIC (X'00000008')
Prefer public address
IPV6_PREFER_SRC_CGA (X'00000010')
Prefer cryptographically generated address
IPV6_PREFER_SRC_NONCGA (X'00000020')
Prefer non-cryptographically generated address

Some of these flags are contradictory. Combining contradictory flags, such as IPV6_PREFER_SRC_CGA and IPV6_PREFER_SRC_NONCGA, results in error code EINVAL.

See IPV6_ADDR_PREFERENCES and Mapping of GAI_HINTS/GAI_ADDRINFO EFLAGS in SEZAINST(CBLOCK) for the PL/I example of the OPTNAME and flag definitions.

See IPV6_ADDR_PREFERENCES and AI_EFLAGS mappings in SEZAINST(EZACOBOL) for the COBOL example of the OPTNAME and flag definitions.

Contains the 4-byte flags field IPV6_ADDR_PREFERENCES_ FLAGS that is defined in SYS1.MACLIB(BPXYSOCK) with the following flags:
IPV6_PREFER_SRC_HOME (X'00000001')
Prefer home address
IPV6_PREFER_SRC_COA (X'00000002')
Prefer care-of address
IPV6_PREFER_SRC_TMP (X'00000004')
Prefer temporary address
IPV6_PREFER_SRC_PUBLIC (X'00000008')
Prefer public address
IPV6_PREFER_SRC_CGA (X'00000010')
Prefer cryptographically generated address
IPV6_PREFER_SRC_ NONCGA (X'00000020')
Prefer non-cryptographically generated address

See IPV6_ADDR_ PREFERENCES and Mapping of GAI_HINTS/GAI_ADDRINFO EFLAGS in SEZAINST(CBLOCK) for the PL/I example of the OPTNAME and flag definitions.

See IPV6_ADDR_PREFERENCES and AI_EFLAGS mappings in SEZAINST(EZACOBOL) for the COBOL example of the OPTNAME and flag definitions.

IPV6_JOIN_GROUP

Use this option to control the reception of multicast packets and specify that the socket join a multicast group.

This is an IPv6-only socket option.

Contains the IPV6_MREQ structure as defined in SYS1.MACLIB(BPXYSOCK). The IPV6_MREQ structure contains a 16-byte IPv6 multicast address followed by a 4-byte IPv6 interface index number.

If the interface index number is 0, then the stack chooses the local interface.

See the SEZAINST(CBLOCK) for the PL/I example of IPV6_MREQ.

See SEZAINST(EZACOBOL) for the COBOL example of IPV6-MREQ.

N/A
IPV6_LEAVE_GROUP

Use this option to control the reception of multicast packets and specify that the socket leave a multicast group.

This is an IPv6-only socket option.

Contains the IPV6_MREQ structure as defined in SYS1.MACLIB(BPXYSOCK). The IPV6_MREQ structure contains a 16-byte IPv6 multicast address followed by a 4-byte IPv6 interface index number.

If the interface index number is 0, then the stack chooses the local interface.

See the SEZAINST(CBLOCK) for the PL/I example of IPV6_MREQ.

See SEZAINST(EZACOBOL) for the COBOL example of IPV6-MREQ.

N/A
IPV6_MULTICAST_HOPS

Use to set or obtain the hop limit used for outgoing multicast packets.

This is an IPv6-only socket option.

Contains a 4-byte binary value specifying the multicast hops. If not specified, then the default is 1 hop.

-1 indicates use stack default.

0 – 255 is the valid hop limit range.

Note: An application must be APF authorized to enable it to set the hop limit value above the system defined hop limit value. CICS® applications cannot execute as APF authorized.
Contains a 4-byte binary value in the range 0 – 255 indicating the number of multicast hops.
IPV6_MULTICAST_IF

Use this option to set or obtain the index of the IPv6 interface used for sending outbound multicast datagrams from the socket application.

This is an IPv6-only socket option.

Contains a 4-byte binary field containing an IPv6 interface index number. Contains a 4-byte binary field containing an IPv6 interface index number.
IPV6_MULTICAST_LOOP

Use this option to control or determine whether a multicast datagram is looped back on the outgoing interface by the IP layer for local delivery when datagrams are sent to a group to which the sending host itself belongs. The default is to loop multicast datagrams back.

This is an IPv6-only socket option.

A 4-byte binary field.

To enable, set to 1.

To disable, set to 0.

A 4-byte binary field.

If enabled, contains a 1.

If disabled, contains a 0.

IPV6_UNICAST_HOPS

Use this option to set or obtain the hop limit used for outgoing unicast IPv6 packets.

This is an IPv6-only socket option.

Contains a 4-byte binary value specifying the unicast hops. If not specified, then the default is 1 hop.

-1 indicates use stack default.

0 – 255 is the valid hop limit range.

Note: APF authorized applications are permitted to set a hop limit that exceeds the system configured default. CICS applications cannot execute as APF authorized.

Contains a 4-byte binary value in the range 0 – 255 indicating the number of unicast hops.

IPV6_V6ONLY

Use this option to set or determine whether the socket is restricted to send and receive only IPv6 packets. The default is to not restrict the sending and receiving of only IPv6 packets.

This is an IPv6-only socket option.

A 4-byte binary field.

To enable, set to 1.

To disable, set to 0.

A 4-byte binary field.

If enabled, contains a 1.

If disabled, contains a 0.

MCAST_BLOCK_SOURCE

Use this option to enable an application to block multicast packets that have a source address that matches the given source address. You must specify an interface index and a source address with this option. The specified multicast group must have been joined previously.

Contains the GROUP_SOURCE_REQ structure as defined in SYS1.MACLIB(BPXYSOCK). The GROUP_SOURCE_REQ structure contains a 4-byte interface index number followed by a socket address structure of the multicast address and a socket address structure of the source address.

See SEZAINST(CBLOCK) for the PL/I example of GROUP_SOURCE_REQ.

See SEZAINST(EZACOBOL) for the COBOL example of GROUP-SOURCE-REQ.

N/A
MCAST_JOIN_GROUP

Use this option to enable an application to join a multicast group on a specific interface. You must specify an interface index. Applications that want to receive multicast datagrams must join multicast groups.

Contains the GROUP_REQ structure as defined in SYS1.MACLIB(BPXYSOCK). The GROUP_REQ structure contains a 4-byte interface index number followed by a socket address structure of the multicast address.

See SEZAINST(CBLOCK) for the PL/I example of GROUP_REQ.

See SEZAINST(EZACOBOL) for the COBOL example of GROUP-REQ.

N/A
MCAST_JOIN_SOURCE_GROUP

Use this option to enable an application to join a source multicast group on a specific interface and a source address. You must specify an interface index and the source address. Applications that want to receive multicast datagrams only from specific source addresses need to join source multicast groups.

Contains the GROUP_SOURCE_REQ structure as defined in SYS1.MACLIB(BPXYSOCK). The GROUP_SOURCE_REQ structure contains a 4-byte interface index number followed by a socket address structure of the multicast address and a socket address structure of the source address.

See SEZAINST(CBLOCK) for the PL/I example of GROUP_SOURCE_REQ.

See SEZAINST(EZACOBOL) for the COBOL example of GROUP-SOURCE-REQ.

N/A
MCAST_LEAVE_GROUP

Use this option to enable an application to exit a multicast group or exit all sources for a given multicast groups.

Contains the GROUP_REQ structure as defined in SYS1.MACLIB(BPXYSOCK). The GROUP_REQ structure contains a 4-byte interface index number followed by a socket address structure of the multicast address.

See SEZAINST(CBLOCK) for the PL/I example of GROUP_REQ.

See SEZAINST(EZACOBOL) for the COBOL example of GROUP-REQ.

N/A
MCAST_LEAVE_SOURCE_GROUP

Use this option to enable an application to exit a source multicast group.

Contains the GROUP_SOURCE_REQ structure as defined in SYS1.MACLIB(BPXYSOCK). The GROUP_SOURCE_REQ structure contains a 4-byte interface index number followed by a socket address structure of the multicast address and a socket address structure of the source address.

See SEZAINST(CBLOCK) for the PL/I example of GROUP_SOURCE_REQ.

See SEZAINST(EZACOBOL) for the COBOL example of GROUP-SOURCE-REQ.

N/A
MCAST_UNBLOCK_SOURCE

Use this option to enable an application to unblock a previously blocked source for a given multicast group. You must specify an interface index and a source address with this option.

Contains the GROUP_SOURCE_REQ structure as defined in SYS1.MACLIB(BPXYSOCK). The GROUP_SOURCE_REQ structure contains a 4-byte interface index number followed by a socket address structure of the multicast address and a socket address structure of the source address.

See SEZAINST(CBLOCK) for the PL/I example of GROUP_SOURCE_REQ.

See SEZAINST(EZACOBOL) for the COBOL example of GROUP-SOURCE-REQ.

N/A
SO_ASCII

Use this option to set or determine the translation to ASCII data option. When SO_ASCII is set, data is translated to ASCII. When SO_ASCII is not set, data is not translated to or from ASCII.

Note: This is a REXX-only socket option.

To enable, set to ON.

To disable, set to OFF.

Note: The optvalue is returned and is optionally followed by the name of the translation table that is used if translation is applied to the data.

If enabled, contains ON.

If disabled, contains OFF.

Note: The optvalue is returned and is optionally followed by the name of the translation table that is used if translation is applied to the data.
SO_BROADCAST

Use this option to set or determine whether a program can send broadcast messages over the socket to destinations that can receive datagram messages. The default is disabled.

Note: This option has no meaning for stream sockets.

A 4-byte binary field.

To enable, set to 1 or a positive value.

To disable, set to 0.

A 4-byte field.

If enabled, contains a 1.

If disabled, contains a 0.

SO_DEBUG

Use SO_DEBUG to set or determine the status of the debug option. The default is disabled. The debug option controls the recording of debug information.

Notes:
  1. This is a REXX-only socket option.
  2. This option has meaning only for stream sockets.

To enable, set to ON.

To disable, set to OFF.

If enabled, contains ON.

If disabled, contains OFF.

SO_EBCDIC

Use this option to set or determine the translation to EBCDIC data option. When SO_EBCDIC is set, data is translated to EBCDIC. When SO_EBCDIC is not set, data is not translated to or from EBCDIC. This option is ignored by EBCDIC hosts.

Note: This is a REXX-only socket option.

To enable, set to ON.

To disable, set to OFF.

Note: The optvalue is returned and is optionally followed by the name of the translation table that is used if translation is applied to the data.

If enabled, contains ON.

If disabled, contains OFF.

Note: The optvalue is returned and is optionally followed by the name of the translation table that is used if translation is applied to the data.
SO_ERROR

Use this option to request pending errors on the socket or to check for asynchronous errors on connected datagram sockets or for other errors that are not explicitly returned by one of the socket calls. The error status is clear afterwards.

N/A A 4-byte binary field containing the most recent ERRNO for the socket.
SO_KEEPALIVE

Use this option to set or determine whether the keep alive mechanism periodically sends a packet on an otherwise idle connection for a stream socket.

The default is disabled.

When activated, the keep alive mechanism periodically sends a packet on an otherwise idle connection. If the remote TCP does not respond to the packet or to retransmissions of the packet, the connection is terminated with the error ETIMEDOUT.

A 4-byte binary field.

To enable, set to 1 or a positive value.

To disable, set to 0.

A 4-byte binary field.

If enabled, contains a 1.

If disabled, contains a 0.

SO_LINGER

Use this option to control or determine how TCP/IP processes data that has not been transmitted when a CLOSE is issued for the socket. The default is disabled.

Notes:
  1. This option has meaning only for stream sockets.
  2. If you set a zero linger time, the connection cannot close in an orderly manner, but stops, resulting in a RESET segment being sent to the connection partner. Also, if the aborting socket is in nonblocking mode, the close call is treated as though no linger option had been set.

When SO_LINGER is set and CLOSE is called, the calling program is blocked until the data is successfully transmitted or the connection has timed out.

When SO_LINGER is not set, the CLOSE returns without blocking the caller, and TCP/IP continues to attempt to send data for a specified time. This usually allows sufficient time to complete the data transfer.

Use of the SO_LINGER option does not guarantee successful completion because TCP/IP only waits the amount of time specified in OPTVAL for SO_LINGER.

Contains an 8-byte field containing two 4-byte binary fields.

Assembler coding:

ONOFF   DS F 
LINGER  DS F  

COBOL coding:

ONOFF  PIC 9(8) BINARY. 
LINGER PIC 9(8) BINARY. 

Set ONOFF to a nonzero value to enable and set to 0 to disable this option. Set LINGER to the number of seconds that TCP/IP lingers after the CLOSE is issued.

Contains an 8-byte field containing two 4-byte binary fields.

Assembler coding:

ONOFF   DS F 
LINGER  DS F  

COBOL coding:

ONOFF  PIC 9(8) BINARY. 
LINGER PIC 9(8) BINARY. 

A nonzero value returned in ONOFF indicates enabled, a 0 indicates disabled. LINGER indicates the number of seconds that TCP/IP will try to send data after the CLOSE is issued.

SO_OOBINLINE

Use this option to control or determine whether out-of-band data is received.

Note: This option has meaning only for stream sockets.

When this option is set, out-of-band data is placed in the normal data input queue as it is received and is available to a RECV or a RECVFROM even if the OOB flag is not set in the RECV or the RECVFROM.

When this option is disabled, out-of-band data is placed in the priority data input queue as it is received and is available to a RECV or a RECVFROM only when the OOB flag is set in the RECV or the RECVFROM.

A 4-byte binary field.

To enable, set to 1 or a positive value.

To disable, set to 0.

A 4-byte binary field.

If enabled, contains a 1.

If disabled, contains a 0.

SO_RCVBUF

Use this option to control or determine the size of the data portion of the TCP/IP receive buffer.

The size of the data portion of the receive buffer is protocol-specific, based on the following values prior to any SETSOCKOPT call:

  • TCPRCVBufrsize keyword on the TCPCONFIG statement in the PROFILE.TCPIP data set for a TCP Socket
  • UDPRCVBufrsize keyword on the UDPCONFIG statement in the PROFILE.TCPIP data set for a UDP Socket
  • The default of 65535 for a raw socket

A 4-byte binary field.

To enable, set to a positive value specifying the size of the data portion of the TCP/IP receive buffer.

To disable, set to a 0.

A 4-byte binary field.

If enabled, contains a positive value indicating the size of the data portion of the TCP/IP receive buffer.

If disabled, contains a 0.

SO_RCVTIMEO

Use this option to control or determine the maximum length of time that a receive-type function can wait before it completes.

If a receive-type function has blocked for the maximum length of time that was specified without receiving data, control is returned with an errno set to EWOULDBLOCK. The default value for this option is 0, which indicates that a receive-type function does not time out.

When the MSG_WAITALL flag (stream sockets only) is specified, the timeout takes precedence. The receive-type function can return the partial count. See the explanation of that operation's MSG_WAITALL flag parameter.

The following receive-type functions are supported:
  • READ
  • READV
  • RECV
  • RECVFROM
  • RECVMSG
This option requires a TIMEVAL structure, which is defined in SYS1.MACLIB( BPXYRLIM) macro. The TIMEVAL structure contains the number of seconds and microseconds specified as fullword binary numbers. The seconds can be a value in the range 0 - 2 678 400 (equal to 31 days), and the microseconds can be a value in the range 0 - 1 000 000 (equal to 1 second). Although TIMEVAL value can be specified using microsecond granularity, the internal TCP/IP timers that are used to implement this function have a granularity of approximately 100 milliseconds. This option stores a TIMEVAL structure that is defined in the SYS1.MACLIB(BPXYRLIM) macro. The TIMEVAL structure contains the number of seconds and microseconds, which are specified as fullword binary numbers. The number of seconds value that is returned is in the range 0 - 2 678 400 (equal to 31 days). The number of microseconds value that is returned is in the range 0 - 1 000 000.
SO_REUSEADDR

Use this option to control or determine whether local addresses are reused. The default is disabled. This alters the normal algorithm used with BIND. The normal BIND algorithm allows each Internet address and port combination to be bound only once. If the address and port have been already bound, then a subsequent BIND will fail and result error will be EADDRINUSE.

When this option is enabled, the following situations are supported:

  • A server can BIND the same port multiple times as long as every invocation uses a different local IP address and the wildcard address INADDR_ANY is used only one time per port.
  • A server with active client connections can be restarted and can bind to its port without having to close all of the client connections.
  • For datagram sockets, multicasting is supported so multiple bind() calls can be made to the same class D address and port number.
  • If you require multiple servers to BIND to the same port and listen on INADDR_ANY, see the SHAREPORT option on the PORT statement in TCPIP.PROFILE.

A 4-byte binary field.

To enable, set to 1 or a positive value.

To disable, set to 0.

A 4-byte binary field.

If enabled, contains a 1.

If disabled, contains a 0.

SO_SNDBUF

Use this option to control or determine the size of the data portion of the TCP/IP send buffer. The size of the TCP/IP send buffer is protocol specific and is based on the following conditions:

  • The TCPSENDBufrsize keyword on the TCPCONFIG statement in the PROFILE.TCPIP data set for a TCP socket
  • The UDPSENDBufrsize keyword on the UDPCONFIG statement in the PROFILE.TCPIP data set for a UDP socket
  • The default of 65535 for a raw socket

A 4-byte binary field.

To enable, set to a positive value specifying the size of the data portion of the TCP/IP send buffer.

To disable, set to a 0.

A 4-byte binary field.

If enabled, contains a positive value indicating the size of the data portion of the TCP/IP send buffer.

If disabled, contains a 0.

SO_SNDTIMEO

Use this option to control or determine the maximum length of time that a send-type function can remain blocked before it completes.

If a send-type function has blocked for this length of time, it returns with a partial count or, if no data is sent, with an errno set to EWOULDBLOCK. The default value for this is 0, which indicates that a send-type function does not time out.

For a SETSOCKOPT, the following send-type functions are supported:
  • SEND
  • SENDMSG
  • SENDTO
  • WRITE
  • WRITEV
This option requires a TIMEVAL structure, which is defined in the SYS1.MACLIB( BPXYRLIM) macro. The TIMEVAL structure contains the number of seconds and microseconds specified as fullword binary numbers. The seconds value is in the range 0 - 2 678 400 (equal to 31 days), and the microseconds value is in the range 0 - 1 000 000 (equal to 1 second). Although the TIMEVAL value can be specified using microsecond granularity, the internal TCP/IP timers that are used to implement this function have a granularity of approximately 100 milliseconds. This option stores a TIMEVAL structure that is defined in SYS1.MACLIB(BPXYRLIM). The TIMEVAL structure contains the number of seconds and microseconds, which are specified as fullword binary numbers. The number of seconds value that is returned is in the range 0 - 2 678 400 (equal to 31 days). The microseconds value that is returned is in the range 0 - 1 000 000.
SO_TYPE

Use this option to return the socket type.

N/A

A 4-byte binary field indicating the socket type:

X'1' indicates SOCK_STREAM.

X'2' indicates SOCK_DGRAM.

X'3' indicates SOCK_RAW.

TCP_KEEPALIVE

Use this option to set or determine whether a socket-specific timeout value (in seconds) is to be used in place of a configuration-specific value whenever keep alive timing is active for that socket.

When activated, the socket-specified timer value remains in effect until respecified by SETSOCKOPT or until the socket is closed. See the z/OS Communications Server: IP Programmer's Guide and Reference for more information about the socket option parameters.

A 4-byte binary field.

To enable, set to a value in the range of 1 – 2 147 460.

To disable, set to a value of 0.

A 4-byte binary field.

If enabled, contains the specific timer value (in seconds) that is in effect for the given socket.

If disabled, contains a 0 indicating keep alive timing is not active.

TCP_NODELAY

Use this option to set or determine whether data sent over the socket is subject to the Nagle algorithm (RFC 896).

Under most circumstances, TCP sends data when it is presented. When this option is enabled, TCP will wait to send small amounts of data until the acknowledgment for the previous data sent is received. When this option is disabled, TCP will send small amounts of data even before the acknowledgment for the previous data sent is received.

Note: Use the following format to set TCP_NODELAY OPTNAME value for COBOL programs:
01 TCP-NODELAY-VAL PIC 9(10) COMP 
     VALUE 2147483649.
01 TCP-NODELAY-REDEF REDEFINES 
     TCP-NODELAY-VAL.
 05 FILLER PIC 9(6) BINARY.
 05 TCP-NODELAY PIC 9(8) BINARY.

A 4-byte binary field.

To enable, set to a 0.

To disable, set to a 1 or nonzero.

A 4-byte binary field.

If enabled, contains a 0.

If disabled, contains a 1.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014