Socket::Multicast6(3pm) | User Contributed Perl Documentation | Socket::Multicast6(3pm) |
Socket::Multicast6 - Constructors and constants for IPv4 and IPv6 multicast socket operations.
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: $!" );
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.
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.
IO::Socket::Multicast6 (The easier, object-oriented way)
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.
2022-11-27 | perl v5.36.0 |