9#include <framework/logging/LogConnectionUDP.h>
10#include <framework/logging/LogMessage.h>
12using namespace boost::asio;
13using boost::asio::ip::udp;
20 ip::udp::resolver::query udpquery(udp::v4(), hostname, std::to_string(port));
34 const std::string& jsonMessage = message.toJSON(
true);
36 boost::system::error_code err;
38 const bool sent = err.value() != 0;
~LogConnectionUDP() override
Close the socket on destruction.
boost::asio::ip::udp::endpoint m_remoteEndpoint
the remote endpoint we send to
boost::asio::ip::udp::socket m_socket
the socket to the UDP server
bool sendMessage(const LogMessage &message) final
Send the log message as JSON to the UDP server.
bool isConnected() final
there is no way to check if a UDP connection is fine, so we just return True always
LogConnectionUDP(const std::string &hostname, unsigned short port)
Create a new UDP log connection with the hostname (as name or IP) and the port to connect to.
boost::asio::io_service m_ioservice
asio service for handling the requests
Abstract base class for different kinds of events.