7#include <boost/asio/buffer.hpp>
8#include <boost/asio/experimental/coro.hpp>
9#include <boost/asio/ip/udp.hpp>
10#include <boost/asio/use_awaitable.hpp>
11#include <boost/asio/uses_executor.hpp>
12#include <boost/system/detail/error_code.hpp>
13#include <boost/thread/future.hpp>
18#include <spdlog/spdlog.h>
33 ,
socket_{ io_executor, asio::ip::
udp::endpoint{ asio::ip::
udp::v4(), 0 } }
43 const auto read_size =
50 auto error = boost::system::error_code{};
54 spdlog::warn(
"UDP: Failed to close the socket with endpoint: {} due to the error: {}",
62 auto total_size = std::size_t{};
63 spdlog::debug(
"UDP: Starting to send data to the remote point {}",
remote_endpoint_);
67 if (not msg.has_value())
71 const auto read_size =
73 total_size += read_size;
74 msg =
co_yield read_size;
77 spdlog::debug(
"UDP: Stopped sending the message. Sent bytes: {}", total_size);
82 boost::system::error_code
err_;
95 asio::ip::udp::endpoint remote_endpoint,
124 std::vector<std::unique_ptr<connection::UDPWriterConnection>>
connections_;
asio::ip::udp::endpoint remote_endpoint_
asio::ip::udp::socket socket_
boost::system::error_code err_
UDPWriterConnection(io_context_type &io_executor, asio::ip::udp::endpoint remote_endpoint)
auto get_executor() const
std::string_view InputType
auto send_continuous_message() -> asio::experimental::coro< OutputType(std::optional< InputType >)>
io_context_type * io_context_
auto send_sync_message(InputType input_data) -> OutputType
auto get_n_lines() const -> std::size_t
std::string_view InputType
std::expected< OutputType, std::string_view > RunResult
auto get_required_conversion() const -> DataConvertOptions
auto operator()(std::size_t line_number=0) const -> OutputType
std::vector< std::unique_ptr< connection::UDPWriterConnection > > connections_
static constexpr auto IsStructType
auto run(const OutputTo< InputType > auto &prev_data_converter, std::size_t line_number=0) -> RunResult
auto is_deserialize_valid() const
UDP(io_context_type &io_context, asio::ip::udp::endpoint remote_endpoint, std::size_t n_lines, process::DataConvertOptions deser_mode=process::DataConvertOptions::none)
std::vector< OutputType > output_data_
asio::thread_pool io_context_type