fawkes::MulticastDatagramSocket Class Reference
[Fawkes Network Communication]

Multicast datagram socket. More...

#include <netcomm/socket/datagram.h>

Inheritance diagram for fawkes::MulticastDatagramSocket:

[legend]
List of all members.

Public Member Functions

 MulticastDatagramSocket (const char *multicast_addr_s, unsigned short port, float timeout=0.f)
 Constructor.
 MulticastDatagramSocket (MulticastDatagramSocket &s)
 Copy constructor.
virtual ~MulticastDatagramSocket ()
 Destructor.
virtual Socketclone ()
 Clone socket.
virtual void bind ()
 Bind socket.
virtual void send (void *buf, unsigned int buf_len)
 Send data.
void set_loop (bool loop)
 Set loopback of sent packets.
void set_ttl (int ttl)
 Set multicast time-to-live (TTL).

Detailed Description

Multicast datagram socket.

An multicast UDP socket on top of IP.

Author:
Tim Niemueller

Definition at line 32 of file datagram_multicast.h.


Constructor & Destructor Documentation

fawkes::MulticastDatagramSocket::MulticastDatagramSocket ( const char *  multicast_addr_s,
unsigned short  port,
float  timeout = 0.f 
)

Constructor.

Parameters:
multicast_addr_s textual representation of the multicast IP address to use for multicast communication. NOT a hostname!
port port
timeout timeout, if 0 all operationsare blocking, otherwise it is tried for timeout seconds.

Definition at line 50 of file datagram_multicast.cpp.

References set_loop().

Referenced by clone().

fawkes::MulticastDatagramSocket::MulticastDatagramSocket ( MulticastDatagramSocket datagram_socket  ) 

Copy constructor.

Parameters:
datagram_socket socket to copy.

Definition at line 80 of file datagram_multicast.cpp.

References multicast_addr.

fawkes::MulticastDatagramSocket::~MulticastDatagramSocket (  )  [virtual]

Destructor.

Definition at line 71 of file datagram_multicast.cpp.


Member Function Documentation

void fawkes::MulticastDatagramSocket::bind (  )  [virtual]

Bind socket.

This will make the socket listen for incoming traffic. It will also add this host to the appropriate multicast group.

Definition at line 93 of file datagram_multicast.cpp.

References fawkes::Socket::sock_fd.

Referenced by fawkes::WorldInfoTransceiver::WorldInfoTransceiver().

Socket * fawkes::MulticastDatagramSocket::clone (  )  [virtual]

Clone socket.

Returns:
a copied instance of MulticastDatagramSocket.

Implements fawkes::Socket.

Definition at line 122 of file datagram_multicast.cpp.

References MulticastDatagramSocket().

void fawkes::MulticastDatagramSocket::send ( void *  buf,
unsigned int  buf_len 
) [virtual]

Send data.

This will send the given data to the multicast address specified in the constructor.

Parameters:
buf buffer to write
buf_len length of buffer, number of bytes to write to stream

Definition at line 135 of file datagram_multicast.cpp.

References fawkes::Exception::append(), and fawkes::Socket::send().

void fawkes::MulticastDatagramSocket::set_loop ( bool  loop  ) 

Set loopback of sent packets.

Parameters:
loop true to deliver sent packets to local sockets, false prevent delivering

Definition at line 150 of file datagram_multicast.cpp.

References fawkes::Socket::sock_fd.

Referenced by MulticastDatagramSocket(), and fawkes::WorldInfoTransceiver::set_loop().

void fawkes::MulticastDatagramSocket::set_ttl ( int  ttl  ) 

Set multicast time-to-live (TTL).

Parameters:
ttl time-to-live

Definition at line 163 of file datagram_multicast.cpp.

References fawkes::Socket::sock_fd.


The documentation for this class was generated from the following files:
Generated on Tue Feb 22 13:32:52 2011 for Fawkes API by  doxygen 1.4.7