A general purpose multicast sender.
More...
#include <MulticastSender.h>
A general purpose multicast sender.
This class forms the underpinnings of the MulticastTypedSender class.
◆ MulticastSender() [1/2]
Initialisation constructor.
- Parameters
-
| [in] | ioContext | - External boost IO context to manage ASIO. |
| [in] | multicastConnection | - Connection object describing target multicast group address and port. |
| [in] | interfaceAddress | - Optional interface IP address for outgoing network messages. |
| [in] | enableLoopback | - Optional allow multicasts to loopback on same adapter. |
| [in] | ttl | - Optional time-to-live for multicast messages. |
| [in] | sendBufferSize | - Socket send option to control send buffer size. |
Typically use this constructor when managing a pool of threads using an instance of core_lib::asio::IoContextThreadGroup in your application to manage a pool of std::threads. This means you can use a single thread pool and all ASIO operations will be executed using this thread pool managed by a single IO context. This is the recommended constructor.
◆ MulticastSender() [2/2]
Initialisation constructor.
- Parameters
-
| [in] | multicastConnection | - Connection object describing target multicast group address and port. |
| [in] | interfaceAddress | - Optional interface IP address for outgoing network messages. |
| [in] | enableLoopback | - Optional allow multicasts to loopback on same adapter. |
| [in] | ttl | - Optional time-to-live for multicast messages. |
| [in] | sendBufferSize | - Socket send option to control send buffer size. |
This constructor does not require an external IO context to run instead it creates its own IO context object along with its own thread. For very simple cases this version will be fine but in more performance and resource critical situations the external IO context constructor is recommended.
◆ CreateMulticastSocket()
| void core_lib::asio::udp::MulticastSender::CreateMulticastSocket |
( |
bool |
enableLoopback, |
|
|
eMulticastTTL |
ttl, |
|
|
size_t |
sendBufferSize |
|
) |
| |
|
private |
Create multicast socket.
- Parameters
-
| [in] | enableLoopback | - Allow multicasts to loopback on same adapter. |
| [in] | ttl | - Time-to-live for multicast messages. |
| [in] | sendBufferSize | - Send buffer size. |
◆ InterfaceAddress()
| auto core_lib::asio::udp::MulticastSender::InterfaceAddress |
( |
| ) |
const |
Retrieve interface IP address.
- Returns
- - Interface IP address.
◆ MulticastConnection()
| auto core_lib::asio::udp::MulticastSender::MulticastConnection |
( |
| ) |
const |
Retrieve multicast connection details.
- Returns
- - Connection object describing target multicast group address and port.
◆ SendMessage()
Send a message buffer to the receiver.
- Parameters
-
| [in] | message | - The message buffer. |
- Returns
- Returns the success state of the send as a boolean.
◆ SyncSendTo()
Synchronised send to method.
- Parameters
-
| [in] | message | - Message buffer to send. |
- Returns
- True if successfully sent, false otherwise.
The documentation for this class was generated from the following files: