use strict; use warnings; use IO::Socket::Multicast; my $socket = new IO::Socket::Multicast() or die "cannot create socket: $!\n"; $socket->mcast_send("this is multicast", '239.1.1.1:9999') or die "error: $!\n"; $socket->close(); #### use strict; use warnings; use IO::Socket::Multicast; my $socket = new IO::Socket::Multicast( LocalPort => 9999, ) or die "cannot create socket: $!\n"; my $res = $socket->mcast_add('239.1.1.1'); print "subscribe status: $res\n"; my $data; $socket->recv($data, 1024); print "received: $data\n"; $socket->close();