Boost ASIO Headache
- by bobber205
Man... thought using ASIO in Boost was going to be easy and intuitive. :P
I am starting to get it finally but I am having some trouble. Here's a snippet.
I am having several compiler errors on the async_accept line. What am I doing wrong? :P
I've based my code off of this page:
http://www.boost.org/doc/libs/1_43_0/doc/html/boost_asio/tutorial/tutdaytime3/src.html
bool TestSocket::StartListening(int port)
{
bool didStart = false;
if (!this->listening)
{
//try to listen
acceptor = new tcp::acceptor(this->myService, tcp::endpoint(tcp::v4(), port));
didStart = true; //probably change?
tcp::socket* tempNewSocket = new tcp::socket(this->myService);
acceptor->async_accept(tempNewSocket, boost::bind(&AlexSocket::NewConnection, this, tempNewSocket, boost::asio::placeholders::error) );
}
else //already started!
return false;
this->listening = didStart;
return didStart;
}
void TestSocket::NewConnection(tcp::socket* s, const boost::system::error_code& error)
{
}