I try to make a class to use UDP. I want to have the endpoint initialized after the constructor, so I modify it as follows:
class UdpSender
{
private:
boost
No. According to the Asio reference, the endpoint object should be configured via its constructors.
However, you could hold the endpoint
by [smart-]pointer, and create it after UdpSender
construction.
// defining:
private:
boost::shared_ptr<boost::asio::ip::udp::endpoint> endpoint;
// creating in Initialize()
endpoint = boost::make_shared<boost::asio::ip::udp::endpoint>(boost::asio::ip::address::from_string(multicast_address), multicast_port);