Ticket #2835 (closed Bugs: wontfix)
basic_stream_socket::available() does not work reliably
|Reported by:||sidharth@…||Owned by:||chris_kohlhoff|
basic_stream_socket::available() often reports 0 bytes even when there is data available to be read.
The implementation of basic_stream_socket::available() for windows uses ioctlsocket() with FIONREAD which Microsoft advises against using. (recv(MSG_PEEK) is not prescribed either).
For clients wanting to poll for available data and then calling a blocking read, barring any other reliable way to peek for data availability, it would be better to have an isavailable() (based on select()) which a client could call before doing a read_some.
I realize the root cause is a Microsoft issue, but it's a boost asio bug at the end of the day.