I have an error in the following code when I tried to compile this:
void Server::accept(void) { Network::ptr connection = Network::initialize(this->my_acceptor.get_io_service()); this->my_acceptor.async_accept(connection->socket(), bind(&Server::endCmd, this, *connection, placeholders::error)); } void Server::endCmd(Network connection, const boost::system::error_code& error) { if (!error) { std::cout << "success!" << std::endl; connection.start(); this->accept(); } }
VC ++ 2010 tell me the following error:
Error 1 error C2248: 'boost::asio::basic_io_object<IoObjectService>::basic_io_object' : cannot access private member declared in class 'boost::asio::basic_io_object<IoObjectService>'
I know that this error occurs on this line, because when I comment on it, the error disappears ... After some research, probably with the socket class, when I call connection->getSocket() , but this function returns ref in socket instance:
tcp::socket& Network::socket(void) { return (this->my_socket); }
so I did not find a solution on the Internet :(
Anyone have an idea plz?
source share