Socket::Multicast6(3pm)

Socket::Multicast63pm

Constructors and constants for ipv4 and ipv6 multicast socket operations.

Usage

  use Socket::Multicast6 qw(:all);
  my $ip = getprotobyname( 'ip' );
  
  my $ip_mreq = pack_ip_mreq( inet_aton( $mcast_addr ), inet_aton( $if_addr ) );
  my $ipv6_mreq = pack_ipv6_mreq( inet_pton( AF_INET6, $mcast6_addr ), $if_index );
  setsockopt( $sock, $ip, IP_ADD_MEMBERSHIP, $ip_mreq )
    or die( "setsockopt IP_ADD_MEMBERSHIP failed: $!" );
  setsockopt( $sock, $ip, IP_DROP_MEMBERSHIP, $ip_mreq )
    or die( "setsockopt IP_DROP_MEMBERSHIP failed: $!" );
  setsockopt( $sock, $ip, IP_MULTICAST_LOOP, pack( 'C', $loop ) )
    or die( "setsockopt IP_MULTICAST_LOOP failed: $!" );
  setsockopt( $sock, $ip, IP_MULTICAST_TTL, pack( 'C', $ttl ) )
    or die( "setsockopt IP_MULTICAST_TTL failed: $!" );

Overview

This module is used to gain access to constants and utility functions used when manipulating multicast socket attributes.

For simple, object-oriented way of doing the same thing, take a look at IO::Socket::Multicast6 or IO::Socket::Multicast.

Exports

By default nothing is exported, you can use the 'ipv4', 'ipv6' and 'independent' to export a specific protocol family, or 'all' to export all symbols.

Functions

$ip_mreq = pack_ip_mreq(MCAST_ADDR, IF_ADDR)
$ip_mreq_source = pack_ip_mreq_source(MCAST_ADDR, SOURCE_ADDR, IF_ADDR)
$ipv6_mreq = pack_ipv6_mreq(MCAST6_ADDR, IF_INDEX)

Constants

IP_MULTICAST_IF
IP_MULTICAST_TTL
IP_MULTICAST_LOOP
IP_ADD_MEMBERSHIP
IP_DROP_MEMBERSHIP
IP_ADD_SOURCE_MEMBERSHIP
IP_DROP_SOURCE_MEMBERSHIP
IPV6_MULTICAST_IF
IPV6_MULTICAST_HOPS
IPV6_MULTICAST_LOOP
IPV6_JOIN_GROUP
IPV6_LEAVE_GROUP
MCAST_JOIN_GROUP
MCAST_BLOCK_SOURCE
MCAST_UNBLOCK_SOURCE
MCAST_LEAVE_GROUP
MCAST_JOIN_SOURCE_GROUP
MCAST_LEAVE_SOURCE_GROUP

Releases

8 releases since Debian 6.0 (Squeeze); the text changed 7 times.

  1. 6.0
  2. 7
  3. 8
  4. 9
  5. 10
  6. 11
  7. 12
  8. 13

Author

Based on Socket::Multicast by Jonathan Steinert, <[email protected]> Socket::Multicast6 by Nicholas J Humfrey, <[email protected]>

From libsocket-multicast6-perl 0.04-5+b3 in Debian 13 (Trixie). Parsed by carta from the page's man source.