Closed thomas-holmes closed 10 years ago
Another option is to loop around #recv
until the desired amount of bytes have been retrieved. I have tried both and this is a smaller code change. It's possible that looping with #recv
might allow for better behavior around an unstable network situation.
I'm not exactly sure how to write a test for this, I only encountered the problem with large messages (4000+ bytes) when going between machines.
:+1:
Applied. Thanks!
#recv
only has to provide up to the amount of requested bytes so it can terminate on large messages. Use#read
instead which delivers exactly the requested number of bytes.