#!/usr/bin/perl -wl # joins a multicast group and spams the results to a unicast destination. # tom@marmot.org.uk use strict; use IO::Socket; use IO::Socket::Multicast; unless (@ARGV) { print "usage: $0 mcast_group:port destination:port [source[:port]]"; exit 0; } my ($mcast_group,$mcast_port) = split ':',shift @ARGV; my $sock = IO::Socket::Multicast->new( LocalPort => $mcast_port, LocalAddr => $mcast_group, ReuseAddr => 1 ); $sock->mcast_add($mcast_group); my $s_sock = IO::Socket::INET->new( Proto => 'udp', PeerAddr => shift @ARGV, LocalAddr => shift @ARGV ); while (1) { recv($sock, my $data, 1500, 0); $s_sock->send($data); }