IPV6_MULTICAST_IF

In order to control which interface multicast datagrams will be sent on, the API provides the IPV6_MULTICAST_IF socket option. This option can be used to set the interface for sending outbound multicast datagrams from the sockets application. Multicast datagrams can be transmitted on only one interface at a time. You can determine the interface being used by the way of the GETSOCKOPT API with IPV6_MULTICAST_IF as the OPTNAME. The IPV6_MULTICAST_IF socket option requires that the option value be the value of the IPv6 interface index.

Figure 1 illustrates the use of IPV6_MULTICAST_IF by the use of the SETSOCKOPT and GETSOCKOPT APIs.
Figure 1. IPV6_MULTICAST_IF
          ***********************************************************************
          *                                                                     *
          *        Issue SETSOCKOPT/GETSOCKOPT - IPV6_MULTICAST_IF              *
          *                                                                     *
          ***********************************************************************
                   EZASMI TYPE=SETSOCKOPT,  ISSUE SETSOCKOPT                     X
                         S=S,               SOCKET DESCRIPTOR                    X
                         OPTLEN=OPTLEN4,    OPTION LENGTH                        X
                         OPTNAME='IPV6_MULTICAST_IF', OPTION NAME                X
                         OPTVAL=MY_MULTICAST_INTERFACE, OPTION VALUE             X
                         RETCODE=RETCODE,   (SPECIFY RETCODE FIELD)              X
                         ERROR=ERROR        ABEND IF MACRO ERROR  
                   BAL   R14,RCCHECK         --> CHECK IT    
                   XC    MULTIFO,MULTIFO           
                   EZASMI TYPE=GETSOCKOPT,  ISSUE GETSOCKOPT                     X
                         S=S,               SOCKET DESCRIPTOR                    X
                         OPTLEN=OPTLEN4,    OPTION LENGTH                        X
                         OPTNAME='IPV6_MULTICAST_IF', OPTION NAME                X
                         OPTVAL=MULTIFO,    OPTION VALUE                         X
                         RETCODE=RETCODE,   (SPECIFY RETCODE FIELD)              X
                         ERROR=ERROR        ABEND IF MACRO ERROR       
                   BAL   R14,RCCHECK         --> CHECK IT