
I was under the impression that it was threadsafe.
Well, the opposite is stated explicitly: http://www.boost.org/doc/libs/1_41_0/doc/html/boost_asio/reference/ip__tcp/s... (end of the page).
The only other option I have then is to allow the socket read to time out. Why is it that boost::asio::read does not timeout with "SO_RCVTIMEO" or similar, as per normal posix sockets?
IIUC, SO_RCVTIMEO is not really portable. Even if it's implemented on your platform, it probably leaves the socket in an undefined and unusable state (eg., this's stated explicitly for Winsock2). You can access the low-level socket and set whatever option you want, but note that even if SO_RCVTIMEO is supported on your platform, it affects recv() function *only*, while asio::read() probably doesn't use this function at all.
Example code I have seen for timeouts seems to be a lot more complicated than what would be done in posix, ie: http://bicosyes.com/boostasio-synchronous-read-with-timeout/
Surely there is a simpler way?
IMHO, this is the way to go. ASIO is about asynchronous i/o, and this approach is especially useful if you need reliable timeouts and cancellations.