|
Boost Users : |
Subject: Re: [Boost-users] [ASIO] async_accept : Error m_val 1.
From: Cyprien DIOT (cyprien.diot_at_[hidden])
Date: 2011-03-10 04:17:17
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_socket_acceptor/async_accept/overload1.html 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" <boost.lists_at_[hidden]>
Ã: boost-users_at_[hidden]
Envoyé: Jeudi 10 Mars 2011 00:42:24
Objet: Re: [Boost-users] [ASIO] async_accept : Error m_val 1.
> 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_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net