Re:What developers should know about TCP
by anonymoushn on Friday May 15, 2020 @11:08PM
(#23200139)
Most TCP libraries simply do not come with a function that does "read, but only give me 0 bytes or n bytes, and if you get some other number please hang on to the leftovers until next time". I guess I could follow your advice, but the first step of doing that would be to write such a function again.
[ Parent
| on HN ]
Re:What developers should know about TCP
by userbinator on Saturday May 16, 2020 @02:18AM
(#23200906)
They do... with an option called MSG_WAITALL.
That naturally leads to the question of why it's not the default, which can be answered by understanding the history of TCP and computer networking; and more interestingly, how might things have been different if MSG_WAITALL was the default from the beginning.
Re:What developers should know about TCP
by anonymoushn on Saturday May 16, 2020 @04:15AM
(#23201448)
I don't think this gets you nonblocking all-or-nothing recv.