Socket::Multicast - Constructors and constants for multicast socket operations.
use Socket::Multicast qw(:all); my $ip = getprotobyname( 'ip' ); my $ip_mreq = pack_ip_mreq( inat_aton( $mcast_addr ), inet_aton( $if_addr ) ); 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. This module allows you to do the same things as IO::Socket::Multicast, but this is the long way.
IO::Socket::Multicast (The fast way)
Jonathan Steinert, <hachi@cpan.org>
Copyright (C) 2006 by 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.8.8 or, at your option, any later version of Perl 5 you may have available.
To install Socket::Multicast, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Socket::Multicast
CPAN shell
perl -MCPAN -e shell install Socket::Multicast
For more information on module installation, please visit the detailed CPAN module installation guide.