Socket...icast6(3pm)

✨ Socket::Multicast6 β€” bestie edition ✨

okay so this is Socket::Multicast6, a lil Perl module from the User Contributed Perl Documentation section (it lives in the 3pm manpage zone πŸ’…). Think of it as your little toolbox for ✨multicast socket operations✨ on both IPv4 and IPv6. Constants? Got 'em. Constructor helpers? Got those too. Let's get into it πŸ¦‹


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

like… look at that. setsockopt with or die(...) every single time because we do NOT ignore errors in this house 😀✨


πŸ’– DESCRIPTION πŸ’–

So what's the deal with this module? It's your all-access pass 🎟️ β€” it gives you the constants and utility functions you need when you're messing with multicast socket attributes. That's it. That's the whole vibe.

And here's the tea β˜• β€” if you want a simple, object-oriented way of doing the exact same thing, go peek at IO::Socket::Multicast6 or IO::Socket::Multicast. They're giving convenience. They're giving main character energy. iykyk πŸ’…


🫢 EXPORTS 🫢

By default? Nothing. Zero. Nada. πŸ™ˆ

But bestie, you have options:

  • use 'ipv4' to export a specific protocol family
  • use 'ipv6' to export a specific protocol family
  • use 'independent' to export a specific protocol family
  • use 'all' to export all the symbols πŸŽ‰

🧚 FUNCTIONS 🧚

  • $ip_mreq = pack_ip_mreq(MCAST_ADDR, IF_ADDR) β€” packs up an ip_mreq struct for you, from the multicast address and the interface address πŸ’Œ
  • $ip_mreq_source = pack_ip_mreq_source(MCAST_ADDR, SOURCE_ADDR, IF_ADDR) β€” same energy but with a source address in the mix (three args, no skimping) ✨
  • $ipv6_mreq = pack_ipv6_mreq(MCAST6_ADDR, IF_INDEX) β€” the IPv6 version, takes the multicast address plus an interface index (yes, an index, not an address, don't come for me) πŸ¦‹

πŸ‘‘ CONSTANTS πŸ‘‘

Here's the full roster, no one left behind, periodt:

  • 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

eighteen icons, all accounted for πŸ’–


🌈 SEE ALSO 🌈

  • IO::Socket::Multicast6 β€” (The easier, object-oriented way) 🫢 genuinely, if you want the chill route, this is it

πŸ’œ AUTHOR πŸ’œ

Based on Socket::Multicast by Jonathan Steinert, <hachi@cpan.org>

Socket::Multicast6 by Nicholas J Humfrey, <njh@cpan.org>


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.


and that's the whole page, bestie!! πŸŽ€ this lil gem dropped as perl v5.42.3 and it's dated 2026-08-20 β€” so go forth, join your multicast groups, pack your mreqs, and slay πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from