|
Boost Users : |
Subject: Re: [Boost-users] [Asio]What's the behavior of socket.async_write()after socket.close() is called?
From: Igor R (boost.lists_at_[hidden])
Date: 2010-06-07 05:54:52
> bad designed api.
> close() does not need to be public -- it belongs into the destructor.
Usually socket destruction is the consequence of its closing.
How would you emulate the following scheme, if it wouldn't be possible
to close a socket?
// pseudo-code
struct connection : enable_shared_from_this<connection>
{
void read()
{
async_read(socket_, buffer_, bind(&read_handler,
shared_from_this(), _1, _2);
}
void close()
{
socket_.close();
}
private:
tcp::socket socket_;
};
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