If I call recv(1024)
on a connected, blocking, TCP socket, and there is no data in the receive buffer, the recv
call blocks, waiting for data to arrive into the receive buffer.
I've read in several places that recv
blocks until "some" data is in the buffer. How much is "some"? Is there a threshold? And is there a timeout if that threshold is not met (and more than zero bytes are available)?
If my application needs to receive 100 bytes and the first recv
call blocks, what's stopping recv
from returning one byte at a time as it arrives in the receive buffer in my application receive loop for the full 100 bytes?