A general purpose UDP sender.
More...
#include <UdpSender.h>
A general purpose UDP sender.
This class forms the underpinnings of the UdpTypedSender class.
◆ UdpSender() [1/2]
Initialisation constructor.
- Parameters
-
| [in] | ioContext | - External boost IO context to manage ASIO. |
| [in] | receiver | - Connection object describing target receiver's address and port. |
| [in] | sendOption | - Socket send option to control the use of broadcasts/unicast. |
| [in] | sendBufferSize | - Socket send option to control send buffer size. |
Typically use this constructor when managing a bool 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 exectued using this thread pool managed by a single IO context. This is the recommended constructor.
◆ UdpSender() [2/2]
Initialisation constructor.
- Parameters
-
| [in] | receiver | - Connection object describing target receiver's address and port. |
| [in] | sendOption | - Socket send option to control the use of broadcasts/unicast. |
| [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 recommened.
◆ CreateUdpSocket()
| void core_lib::asio::udp::UdpSender::CreateUdpSocket |
( |
eUdpOption |
sendOption, |
|
|
size_t |
sendBufferSize |
|
) |
| |
|
private |
Create UDP socket.
- Parameters
-
| [in] | sendOption | - UDP send option. |
| [in] | sendBufferSize | - Send buffer size. |
◆ ReceiverConnection()
| auto core_lib::asio::udp::UdpSender::ReceiverConnection |
( |
| ) |
const |
Retrieve receiver connection details.
- Returns
- - Connection object describing target receiver's 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: