I am using the latest version of boost and boost.asio.
I have this class:
enum IPVersion
{
IPv4,
IPv6
};
template <IPVersion version = IPv4>
class Connection
{
private:
boost::asio::io_service io_service;
boost::asio::ip::tcp::resolver resolver;
boost::asio::ip::tcp::resolver::query query;
boost::asio::ip::tcp::resolver::iterator iterator;
public:
Connection(std::string host, std::string port);
virtual void connect() { iterator = resolver.resolve(query); } // Is this the moment where the client actually connects?
virtual void disconnect() { /* what goes in here? */ }
};
Should I call io_service::stop()
and then on my Connection::connect()
call io_service::reset()
first before I resolve the query?