GETSOCKOPT

The GETSOCKOPT macro gets the options associated with a socket that were set using the SETSOCKOPT macro.The options for each socket are described by the following parameters. You must specify the option that you want, if you issue the GETSOCKOPT macro.

Format

Read syntax diagramSkip visual syntax diagramEZASMITYPE=GETSOCKOPT ,S= numberaddress*indaddr(reg) ,OPTNAME= 'IP_MULTICAST_IF''IP_MULTICAST_LOOP''IP_MULTICAST_TTL''IPV6_MULTICAST_HOPS''IPV6_MULTICAST_IF''IPV6_MULTICAST_LOOP''IPV6_UNICAST_HOPS''IPV6_V6ONLY''SO_LINGER'address*indaddr(reg) ,OPTVAL= address*indaddr(reg) ,OPTLEN= address*indaddr(reg) ,ERRNO= address*indaddr(reg) ,RETCODE= address*indaddr(reg) ,ECB=address* indaddr( reg),ERROR=address*indaddr(reg),TASK=address*indaddr(reg)

Parameters

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. Set OPTNAME to one of the following options before you issue GETSOCKOPT.
IP_MULTICAST_IF
Use this option to 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.
IP_MULTICAST_LOOP
Use this option to determine whether a copy of multicast datagrams are 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.
IP_MULTICAST_TTL
Use this option to 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.
IPV6_MULTICAST_HOPS
Use this option to obtain the hop limit used for outgoing multicast packets. This is an IPv6-only socket option.
IPV6_MULTICAST_IF
Use this option to obtain the index of the IPv6 interface used for sending outbound multicast datagrams from the socket application. This is an IPv6-only socket option.
IPV6_MULTICAST_LOOP
Use this option to determine whether a multicast datagram is looped back on the outgoing interface by the IP layer for local delivery, if 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.
IPV6_UNICAST_HOPS
Use this option to obtain the hop limit used for outgoing unicast IPv6 packets. This is an IPv6-only socket option.
IPV6_V6ONLY
Use this option to 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.
SO_LINGER
Requests the status of SO_LINGER.
  • If the SO_LINGER option is enabled, and data transmission has not been completed, a CLOSE macro blocks the calling program until the data is transmitted or until the connection has timed out.
  • If SO_LINGER is not enabled, a CLOSE call returns without blocking the caller and TCP/IP continues to try the send data function. Normally the send data function completes and the data is sent, but it cannot be guaranteed because TCP/IP can timeout before the send has been completed.
OPTVAL
Output parameter.
  • If SO_LINGER is specified in OPTNAME, the following structure is returned:
         ONOFF        DS   F
         LINGER       DS   F
    • A nonzero value returned in ONOFF indicates that the option is enabled and a zero value indicates that it is disabled.
    • The LINGER value indicates the time in seconds that TCP/IP continues to try to send the data after the CLOSE call is issued. For information about how to set the LINGER time, see SETSOCKOPT.
OPTLEN
Input parameter. A fullword binary field containing the length of the data returned in OPTVAL.
  • For SO_LINGER, OPTVAL contains two fullwords and OPTLEN is set to 8 (two fullwords).
ERRNO
Output parameter. A fullword binary field. If RETCODE is negative, this field contains an error number. See ERRNO Values for information about ERRNO return codes.
RETCODE
Output parameter. A fullword binary field that returns one of the following:
Value
Description
0
Successful call
-1
Check ERRNO for an error code
ECB
Input parameter. It points to a 160-byte field containing:
  • A four-byte ECB posted by TCP/IP when the macro completes.
  • A 156-byte 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.
ERROR
Input parameter. The location in your program to receive control, if the application programming interface (API) processing module cannot be loaded.
TASK
Input parameter. The location of the task storage area in your program.