(self, ttl=1, dscp=0)
Set options used for transmission of multicast-addressed packets

        Args:
            ttl  : Time-to-live
            dscp : Differentiated services code point (DSCP)
Set options used for transmission of multicast-addressed packets
Set options used for transmission of multicast - addressed packets
def set_mcast_tx_opts(self, ttl=1, dscp=0):
        """Set options used for transmission of multicast-addressed packets

        Args:
            ttl  : Time-to-live
            dscp : Differentiated services code point (DSCP)

        """
        # Define the interface over which to send the multicast messages
        ip_mreqn = struct.pack('4s4si', socket.inet_aton(self.ip),
                               socket.inet_aton('0.0.0.0'), self.ifindex)
        self.sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_IF,
                             ip_mreqn)

        # Set multicast TTL
        self.sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL,
                             struct.pack('b', ttl))

        # Set DSCP
        self.sock.setsockopt(socket.IPPROTO_IP, socket.IP_TOS,
                             struct.pack('b', dscp))

        # Don't loop Tx messages back to us
        self.sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_LOOP, 0)
def set_mcast_tx_opts ( self , ttl = 1 , dscp = 0 ) : # Define the interface over which to send the multicast messages ip_mreqn = struct . pack ( '4s4si' , socket . inet_aton ( self . ip ) , socket . inet_aton ( '0.0.0.0' ) , self . ifindex ) self . sock . setsockopt ( socket . IPPROTO_IP , socket . IP_MULTICAST_IF , ip_mreqn ) # Set multicast TTL self . sock . setsockopt ( socket . IPPROTO_IP , socket . IP_MULTICAST_TTL , struct . pack ( 'b' , ttl ) ) # Set DSCP self . sock . setsockopt ( socket . IPPROTO_IP , socket . IP_TOS , struct . pack ( 'b' , dscp ) ) # Don't loop Tx messages back to us self . sock . setsockopt ( socket . IPPROTO_IP , socket . IP_MULTICAST_LOOP , 0 )