Re: [Boost-users] [ASIO] async_accept : Error m_val 1.

Thank you for your answer.
You're right, with message member function, I get the "Already open" error.
I don't really understand it, my source code is:
void Server::receiving()
{
boost::system::error_code error;
tcp::endpoint endp(tcp::v4(), 14242);
acceptor = new tcp::acceptor(_io);
acceptor->open(endp.protocol());
acceptor->set_option(tcp::acceptor::reuse_address(true));
acceptor->bind(endp);
acceptor->listen();
_client = new tcp::socket(_io);
_client->close();
acceptor->async_accept(*_client, boost::bind(&ipc::handle_accept, this, boost::asio::placeholders::error));
}
What is "already open" ? _client ? It has just been allocated before calling async_accept.
_io is properly initialized.
If this error is about acceptor, how can I use it with async_accept ? I've seen http://www.boost.org/doc/libs/1_37_0/doc/html/boost_asio/reference/basic_soc... but i don't see any line where the listen port is set to acceptor.
I'm sorry for my english which is not very good.
Thank you !
----- Mail original -----
De: "Igor R"
m_val = 1; m_cat = 0x00ab8d00 instance; | [boost::asio::error::detail::misc_category] = {...} | boost::noncopyable_::noncopyable = {...} | __vfptr = 0x00a8bf18 const boost::asio::error::detail::misc_category::`vftable'
Use message() member function of error_code to see the error description. IIUC, in your case it should be "Already open", i.e. you're trying to accept new connection to a socket which was already open. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

What is "already open" ? _client ? It has just been allocated before calling async_accept. _io is properly initialized.
If this error is about acceptor, how can I use it with async_accept ? I've seen http://www.boost.org/doc/libs/1_37_0/doc/html/boost_asio/reference/basic_soc... but i don't see any line where the listen port is set to acceptor.
Like Viatcheslav mentioned, set reuse_address option: http://think-async.com/Asio/boost_asio_1_5_2/doc/html/boost_asio/reference/s...
participants (2)
-
Cyprien DIOT
-
Igor R