2
0

recv.pl 310 B

123456789101112
  1. use IO::Socket::Multicast;
  2. my ($ip,$port) = @ARGV;
  3. $ip and $port or die "Usage $0: <ip> <port>\n";
  4. # create a new UDP socket and add a multicast group
  5. my $socket = IO::Socket::Multicast->new( LocalPort => $port, ReuseAddr => 1 );
  6. $socket->mcast_add($ip);
  7. while($socket->recv($data,1024)) {
  8. print $data;
  9. }