move multicast to perl

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14004 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Brian West
2009-06-27 00:42:36 +00:00
parent 8f57ae41f7
commit 3748f84536
2 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
use IO::Socket::Multicast;
my ($ip,$port) = @ARGV;
$ip and $port or die "Usage $0: <ip> <port>\n";
# create a new UDP socket and add a multicast group
my $socket = IO::Socket::Multicast->new( LocalPort => $port, ReuseAddr => 1 );
$socket->mcast_add($ip);
while($socket->recv($data,1024)) {
$data =~ s/^.{8}//;
print $data;
}

17
scripts/perl/multicast/send.pl Executable file
View File

@@ -0,0 +1,17 @@
#!/usr/local/bin/perl
use IO::Socket::INET;
my ($ip, $port, $file) = @ARGV;
$ip and $port or die "Usage $0: <ip> <port>\n";
$socket = new IO::Socket::INET->new( PeerPort => $port,
Proto => 'udp',
PeerAddr => $ip);
open(I, $file);
$/ = undef;
my $buf = <I>;
close(I);
$socket->send("00000000$buf\n");