Net::RTP - Send and receive RTP packets (RFC3550)
use Net::RTP; my $rtp = new Net::RTP( LocalPort=>5170, LocalAddr=>'233.122.227.171' ); my $packet = $rtp->recv(); print "Payload type: ".$packet->payload_type()."\n";
The Net::RTP module subclasses IO::Socket::Multicast6 to enable you to manipulate multicast groups. The multicast additions are optional, so you may also send and recieve unicast packets.
Net::RTP
The new() method is the constructor for the Net::RTP class. It takes the same arguments as IO::Socket::INET, however the Proto argument defaults to "udp", which is more appropriate for RTP.
The Net::RTP super-class used will depend on what is available on your system it will try and use one of the following (in order of preference) :
IO::Socket::Multicast6 (IPv4 and IPv6 unicast and multicast) IO::Socket::Multicast (IPv4 unicast and multicast) IO::Socket::INET6 (IPv4 and IPv6 unicast) IO::Socket::INET (IPv4 unicast)
If LocalAddr looks like a multicast address, then Net::RTP will automatically try and join that multicast group for you.
Blocks and waits for an RTP packet to arrive on the UDP socket. The read $size defaults to 2048 which is usually big enough to read an entire RTP packet (as it is advisable that packets are less than the Ethernet MTU).
$size
Returns a Net::RTP::Packet object or undef if there is a problem.
Net::RTP::Packet
Send a Net::RTP::Packet from out of the RTP socket. The PeerPort and PeerAddr should be defined in order to send packets. Returns the number of bytes sent, or the undefined value if there is an error.
Returns the name of the super-class that Net::RTP chose to use.
IO::Socket::Multicast6
IO::Socket::INET6
IO::Socket::Multicast
IO::Socket::INET
http://www.ietf.org/rfc/rfc3550.txt
Please report any bugs or feature requests to bug-net-rtp@rt.cpan.org, or through the web interface at http://rt.cpan.org. I will be notified, and then you will automatically be notified of progress on your bug as I make changes.
bug-net-rtp@rt.cpan.org
Nicholas J Humfrey, njh@cpan.org
Copyright (C) 2006 University of Southampton
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.005 or, at your option, any later version of Perl 5 you may have available.
To install Net::RTP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::RTP
CPAN shell
perl -MCPAN -e shell install Net::RTP
For more information on module installation, please visit the detailed CPAN module installation guide.