I have one problem.
I'm developing chat server, using boost::asio.
and Here,
void CServerSocket::StartAccept(boost::asio::ip::tcp::acceptor &acceptor)
{
std::shared_ptr<boost::asio::ip::tcp::socket> socket(new boost::asio::ip::tcp::socket(acceptor.get_io_service()));
acceptor.async_accept(*socket, std::bind(&CServerSocket::OnAccept, boost::asio::placeholders::error, socket,
std::ref(acceptor)));
}
void CServerSocket::OnAccept(const boost::system::error_code &error, std::shared_ptr<boost::asio::ip::tcp::socket> socket,
boost::asio::ip::tcp::acceptor &acceptor)
{
if (error)
{
CLogManager::WriteLog((boost::format("Accept error! : %1%") % error.message()).str().c_str());
return;
}
m_SocketList.push_back(std::make_shared<CConnectionSocket>(this, socket));
StartAccept(acceptor);
}
At std::bind, there are an error occurred.
"Error c2064 term does not evaluate to a function taking 3 arguments"
What should i do?
thanks.
If you're using
std::bind
, replaceboost::asio::placeholders::error
withstd::placeholders::_1
.