Files
commons/include/client.hpp

33 lines
779 B
C++

#pragma once
#include <boost/asio.hpp>
#include <functional>
#include <sstream>
#include <string>
#include <vector>
#include "boost/bind.hpp"
namespace commons {
class client {
public:
client(boost::asio::io_service& io_service,
const boost::asio::ip::address& multicast_address,
short multicast_port, unsigned short tcp_port);
void init();
void set_outbound_interface(const boost::asio::ip::address_v4& address);
void handle_send_to(const boost::system::error_code& error);
void handle_timeout(const boost::system::error_code& error);
private:
boost::asio::ip::udp::endpoint endpoint_;
boost::asio::ip::udp::socket socket_;
boost::asio::deadline_timer timer_;
std::string message_;
unsigned short port_;
};
} // namespace commons