---
name: "Socket::Multicast6"
section: "3pm"
platform: "linux"
package: "libsocket-multicast6-perl"
version: "0.04-5+b3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Socket::Multicast6"
---

# Socket::Multicast6(3pm)

Constructors and constants for IPv4 and IPv6 multicast socket operations.

## NAME

Socket::Multicast6 - Constructors and constants for IPv4 and IPv6 multicast socket operations.

## SYNOPSIS

```
  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: $!" );
```

## DESCRIPTION

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

  ## SEE ALSO

IO::Socket::Multicast6 (The easier, object-oriented way)

## AUTHOR

Based on Socket::Multicast by Jonathan Steinert, \<hachi@cpan.org\> Socket::Multicast6 by Nicholas J Humfrey, \<njh@cpan.org\>

## COPYRIGHT AND LICENSE

Copyright (C) 2006 Nicholas J Humfrey Copyright (C) 2006 Jonathan Steinert

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.6.1 or, at your option, any later version of Perl 5 you may have available.
