Hi,
could you please document the exact behavior of recv()?
What are the possible return values? What do they mean?
Does recv() support the non-blocking mode through setsockopt()?
Does recv() support read timeouts through setsockopt()?
Does recv() support the special return value 0 as the BSD recv() does?
Does select(... &readSet ... timeout=0) set the bit in readSet() when the remote side closed the connection and there is no more data available? (In my opinion is should, CC3000 doesn't.)
At the moment I never see a return value of 0 when the remote socket closed. I also do not see all data which has been sent by the remote. The last few bytes are swallowed once the remote socket was closed and instead I get return value -57 from that point on. Is this the expected behavior?
Concrete question and use case:
How do I cleanly read until the very end of a TCP stream without reading single bytes individually? How can I detect the end?
The Doxygen documentation and the Wiki pages do not disclose any details on how recv() behaves.
Many thanks for your help in advance.
Cheers,
Johannes