#include <multicast_socket.hpp>
Inherits noncopyable.
Describes a hamcast multicast socket.
- Warning
- This class is not thread safe.
- Examples:
- simple_receiver.cpp, and simple_sender.cpp.
hamcast::multicast_socket::multicast_socket |
( |
| ) |
|
Create a new HAMcast socket.
hamcast::multicast_socket::~multicast_socket |
( |
| ) |
|
Releases all ressources and leaves all joined groups.
void hamcast::multicast_socket::add_interface |
( |
interface_id |
iface | ) |
|
Add iface
to the distribution channel of the socket.
- Parameters
-
iface | A hamcast multicast interface. |
void hamcast::multicast_socket::del_interface |
( |
interface_id |
iface | ) |
|
Removes iface
from the distribution channel of the socket.
- Parameters
-
iface | A hamcast multicast interface. |
socket_id hamcast::multicast_socket::id |
( |
| ) |
const |
Get the ID of this socket.
- Returns
- The socket ID of this object.
std::vector< interface_id > hamcast::multicast_socket::interfaces |
( |
| ) |
|
Get all associated interfaces.
- Returns
- A vector of all known interface IDs.
void hamcast::multicast_socket::join |
( |
const uri & |
group | ) |
|
Join a multicast group.
- Parameters
-
group | multicast group that you want to join |
- Examples:
- simple_receiver.cpp.
void hamcast::multicast_socket::leave |
( |
const uri & |
group | ) |
|
Leave a multicast group.
- Parameters
-
group | multicast group that you want to leave |
Receive a multicast message (packet) from this socket.
- Warning
- This is a blocking call.
- Returns
- The received multicast packet.
- Examples:
- simple_receiver.cpp.
void hamcast::multicast_socket::send |
( |
const uri & |
group, |
|
|
size_t |
msg_len, |
|
|
const void * |
buf |
|
) |
| |
Send a multicast message to group
.
- Parameters
-
group | Multicast group of the receivers |
msg_len | Length of buf in bytes. |
buf | Bytes to send. |
- Exceptions
-
- Examples:
- simple_sender.cpp.
void hamcast::multicast_socket::set_interface |
( |
interface_id |
iid | ) |
|
Set associated interface.
- Parameters
-
iid | The hamcast multicast interface that should be used exclusively. |
void hamcast::multicast_socket::set_interfaces |
( |
const std::vector< interface_id > & |
ifs | ) |
|
Set associated interfaces.
- Parameters
-
ifs | The hamcast multicast interfaces. |
void hamcast::multicast_socket::set_ttl |
( |
boost::uint32_t |
value | ) |
|
Change the TTL value used to send data.
The default value is 255.
- Parameters
-
value | The new maximum hop count (TTL). |
Try to receive a multicast message from this socket.
- Parameters
-
storage | A multicast_packet object that should contain the received data on success. |
- Returns
true
if a multicast packet was received; otherwise false
.
bool hamcast::multicast_socket::try_receive |
( |
multicast_packet & |
storage, |
|
|
boost::uint16_t |
milliseconds |
|
) |
| |
Try to receive a multicast message from this socket within the given timeout.
- Parameters
-
storage | A multicast_packet object that should contain the received data on success. |
milliseconds | The maximum time (in milliseconds) this member function should block. |
- Returns
true
if a multicast packet was received; otherwise false
(timeout occured).
The documentation for this class was generated from the following files:
- hamcast/multicast_socket.hpp
- src/multicast_socket.cpp