In my head it looks like this:
- I check the function ioctlsocket ((* this) .sock, FIONREAD, & arg); data availability to read recv;
- If there is nothing, I wait for example 100 ms and check again.
- If so 5-10 times there is nothing - then the server did not answer. Otherwise, I start reading the data.
I ask, because if the client calls recv immediately after send quickly, and the server does not have time to process and send a message back, does the client have nothing to accept? Or again I did not understand something? :)
- 1 second - client sent data
- 2 seconds, the client checked the buffer using ioctlsocket, no data
- 1 second - server received data
- 2 second - server processes data
- 3 seconds - server sends data
Why I ask, can it be or not?