I need to extend an boost::asio::ip::tcp::iostream
application to be able to connect to multiple clients. For this, i am trying to create a:
std::vector<boost::asio::ip::tcp::iostream>
and add iostreams, like this:
std::vector<boost::asio::ip::tcp::iostream> streams;
boost::asio::io_service ios;
boost::asio::ip::tcp::endpoint endpoint
= boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), 4444);
boost::asio::ip::tcp::acceptor acceptor(ios, endpoint);
boost::asio::ip::tcp::iostream stream;
acceptor.accept(*stream.rdbuf());
streams.emplace_back(std::move(stream)); // gives error
the above code gives me an Attempted to reference a deleted function
error.
I have tried push_back
, and emplace_back
as well. Is there a way to use a std::vector<boost::asio::ip::tcp::iostream>
?