I have set up a TCP server and enabled the socket’s options: SO_RCVTIMEO , SO_SNDTIMEO.
I called recv() with the flag MSG_WAITALL and I noticed that there is no timeout on recv() (i.e. after the time defined with SO_RCVTIMEO recv() still blocks())
From what I read I could not find an explicit answer but it sounded like that the timeout option should be in effect, if set ,even with MSG_WAITALL in recv().
I also tried removing the MSG_WAITALL from recv() (setting flags parameter to 0) and still recv() blocks forever without any timeout.
Can you please explain (or help fix) why the timeout does not hold ?
In reply to ToddMullanix:
In reply to Guy Mardiks:
I tried an example with 2.24.02.31 (and again with 2.25.00.09) and it worked fine. I set both SO_RCVTIMEO and SO_SNDTIMEO to 5 seconds. I had my laptop sending a TCP packet (on port 1000)that the target just echo'd back. I had the laptop stop sending for a bit but not close the socket. I checked (via WireShark) that the target closed the socket in 5 seconds.
Here is the primary source file that I used for testing.
The SO_KEEPALIVE option was in the example I tweaked. I expect that it was there for testing purposes. The default send time is 2 hours. If there were no timeouts on the recv/send APIs, its useful in making sure things are still alive. I don't see an strerror equivalent. I'm pinging one of the NDK engineers.
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.