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


MCAST_BLOCK_SOURCE and MCAST_UNBLOCK_SOURCE

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

The MCAST_BLOCK_SOURCE socket option enables the application to block IPv4 or IPv6 multicast packets that have a source address that matches the given source address. The specified multicast group must have been joined previously. The MCAST_UNBLOCK_SOURCE socket option enables the application to unblock a previously blocked source for a given source multicast group. Use the SETSOCKOPT API and specify the GROUP_SOURCE_REQ structure that contains the multicast address, the source address, and the local interface address. The format of the GROUP_SOURCE_REQ structure is in the BPXYSOCK macro. The assembler program example in Figure 1 shows the socket option using the EZASMI macro:

Figure 1. MCAST_BLOCK_SOURCE and MCAST_UNBLOCK_SOURCE
    ***********************************************************************
    *                                                                     *
    *        Issue SETSOCKOPT - MCAST_BLOCK_SOURCE                        *
    *                                                                     *
    ***********************************************************************
              
             EZASMI TYPE=SETSOCKOPT,  ISSUE SETSOCKOPT                     X
                   S=S,               SOCKET DESCRIPTOR                    X
                   OPTLEN=OPTL264,    OPTION LENGTH                        X
                   OPTNAME='MCAST_BLOCK_SOURCE', OPTION NAME               X
                   OPTVAL=GSR_REQ1,   OPTION VALUE                         X
                   ERRNO=ERRNO,       (SPECIFY ERRNO FIELD)                X
                   RETCODE=RETCODE,   (SPECIFY RETCODE FIELD)              X
                   ERROR=ERROR        ABEND IF MACRO ERROR
             BAL   R14,RCCHECK         --> CHECK IT
    *
    * Here your program will perform normal processing such as sending or
    * receiving message.
    *

    ***********************************************************************
    *                                                                     *
    *        Issue SETSOCKOPT - MCAST_UNBLOCK_SOURCE                      *
    *                                                                     *
    ***********************************************************************
              
             EZASMI TYPE=SETSOCKOPT,  ISSUE SETSOCKOPT                     X
                   S=S,               SOCKET DESCRIPTOR                    X
                   OPTLEN=OPTL264,    OPTION LENGTH                        X
                   OPTNAME='MCAST_UNBLOCK_SOURCE', OPTION NAME             X
                   OPTVAL=GSR_REQ1,   OPTION VALUE                         X
                   ERRNO=ERRNO,       (SPECIFY ERRNO FIELD)                X
                   RETCODE=RETCODE,   (SPECIFY RETCODE FIELD)              X
                   ERROR=ERROR        ABEND IF MACRO ERROR
             BAL   R14,RCCHECK         --> CHECK IT 

While the application is a member of the multicast host group, datagrams can be sent or received as required. To see the multicast groups that are joined on an interface, use the Netstat DEvlinks/-d command. To see the multicast groups that are joined on a socket, use the Netstat ALL/-A command.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014