3 Answers
3

The 10 I believe is actually the length of the buffer, so the read will read up to 10 bytes but might not get everything in there or it may not fill it up. I believe it actually returns the number of bytes written to the buffer.

If you want to fill the 10 bytes buffer, you can set SO_RCVLOWAT to 10 and it should work just fine.

poll/select will signal a socket as readable even if there are not SO_RCVLOWAT bytes available (at least on linux). If you intend to use your socket with poll/select, be aware that a call read/recv/etc... after poll/select might block until SO_RCVLOWAT number of bytes are available.