I use Boost.Asio as a simple socket library.
When I open a socket, I create a stream that continues to read on this socket and returns when the socket was closed or some other errors occurred.
while((read = socket->read_some(buf, ec)) != 0) {
// deal with bytes read
}
This code works well on Windows and Mac. However, with linux, when the socket is closed from the main thread, socket::read_someit takes quite a long time to return - I found it for more than 2 minutes.
Is there anything I can do to improve this?
source
share