ENUt
Public Member Functions

nut::MulticastTunnelSocket Class Reference

A socket to be used with the multicast tunnel server. More...

#include <multicasttunnelsocket.h>

Inheritance diagram for nut::MulticastTunnelSocket:
Inheritance graph
[legend]
Collaboration diagram for nut::MulticastTunnelSocket:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 MulticastTunnelSocket ()
 Create an unnamed socket instance.
 MulticastTunnelSocket (const std::string &objName)
 Create an instance with object name objName.
bool create (const IPv4Address &serverAddr, uint16_t serverPort, uint16_t mcastRemotePortNumber)
 Initialize the socket.
bool destroy ()
 Clean up the socket.
uint16_t getLocalPortNumber () const
 Return the port number to which the socket used for communication with the server is bound.

Detailed Description

A socket to be used with the multicast tunnel server.

Multicasting happens entirely on the IP level, which implies that it is totally oblivious to the UDP port value. Now suppose that an on-line radiostation is multicasting its audio stream to a specific multicast group. All the UDP packets which are sent to the multicast group will then contain the same destination port number. To capture the packets, a client will not only need to join the multicast group, but will also need an UDP socket which is bound to that particular UDP port. Since on a single host, only one socket can be bound to a specific port number, only one application will be able to capture the audio traffic on that host.

In some cases this can be a severe limitation. To work around this problem, a 'multicast tunnel server' and a 'multicast tunnel socket' was created. The server is started on a specific host and receives commands from a MulticastTunnelSocket instance. It is the server which will join multicast groups and create UDP sockets on the appropriate port numbers, and the server will forward the incoming packets to all interested clients. Since only the server needs to use UDP sockets bound on specific ports, the problem mentioned above is solved.

Currently, an ENet connection is used for the client-server communication.


Constructor & Destructor Documentation

nut::MulticastTunnelSocket::MulticastTunnelSocket ( )
nut::MulticastTunnelSocket::MulticastTunnelSocket ( const std::string &  objName)

Member Function Documentation

bool nut::MulticastTunnelSocket::create ( const IPv4Address serverAddr,
uint16_t  serverPort,
uint16_t  mcastRemotePortNumber 
)

Initialize the socket.

Parameters:
serverAddrIP address of the multicast tunnel server applicatio to which we should connect.
serverPortPort number on which the server was started and will look for incoming connections.
mcastRemotePortNumberIncoming UDP packets which contain this destination port number and which arrive in a multicast group that we're interested in, will be forwarded to us.
bool nut::MulticastTunnelSocket::destroy ( )
uint16_t nut::MulticastTunnelSocket::getLocalPortNumber ( ) const

The documentation for this class was generated from the following file: