Opened 14 years ago
Closed 14 years ago
#2835 closed Bugs (wontfix)
basic_stream_socket::available() does not work reliably
Reported by: | Owned by: | chris_kohlhoff | |
---|---|---|---|
Milestone: | Boost 1.39.0 | Component: | asio |
Version: | Boost 1.38.0 | Severity: | Problem |
Keywords: | Cc: |
Description
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).
http://support.microsoft.com/kb/192599
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.
Change History (3)
comment:1 by , 14 years ago
Component: | None → asio |
---|---|
Owner: | set to |
comment:2 by , 14 years ago
comment:3 by , 14 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
How do you know that there is data waiting to be read? If you can construct a test case feel free to reopen this bug.
With respect to your "isavailable()" proposal, you already have this facility available using asynchronous reads (with or without using null_buffers) or by setting your socket to non-blocking.
N.B The Microsoft KB article is not related to the behaviour you describe. In fact, the article seems to describe ioctl/FIONREAD working as intended.
I forgot to mention that:
Thanks