Hacker News new | past | comments | ask | show | jobs | submit login

"So the net result was that this optimization really resulted in an extraneous recvfrom call per request, which returned EAGAIN. What was I thinking?"

That only happens if somehow you have received data that is EXACTLY the size of the buffer you send to recvfrom. If you have read less, you know that there is no need to call it again. If your buffer is full, then odds are there is more data to read so the next call won't be useless.

I suspect you actually had an extremely small proportion of "extraneous" calls.




For UDP packets, requesting a read of less than a full packet will discard the rest of the packet. This does not happen for TCP packets though.

Darn those leaky abstractions.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: