Perl can listen on multicast streams easily with IO::Socket::Multicast. There is even an IPv6 version at IO::Socket::Multicast6.
Here is a simple multicast listener example (IPv4-only):
#!/usr/bin/perl use strict; use warnings; use IO::Socket::Multicast; my $sock = IO::Socket::Multicast->new( LocalPort => 7070, ReuseAddr => 1 ) or die "Cannot create client\n";; $sock->mcast_add("239.192.1.1") || die "Cannot set group: $!\n"; my $data; while (1) { $sock->recv($data,1024); my $peer_addr = $sock->peerhost(); my $peer_port = $sock->peerport(); print "($peer_addr:$peer_port): $data\n" }
You can use a select() timer instead of the while loop and if you reach a timeout - send the email.
In reply to Re: Point me in the right direction - Monitor a Mulicast IP address or stream
by VinsWorldcom
in thread Point me in the right direction - Monitor a Mulicast IP address or stream
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |