On Tuesday, 12 December 2017 at 22:11:37 UTC, Adam D. Ruppe wrote:
On Tuesday, 12 December 2017 at 21:52:57 UTC, Ali Çehreli wrote:
The same buffer is used for all segments and socket.receive
should be inside while.
The buffer is copied by the ~= operator, but indeed you're
right that I forgot to receive again inside the loop! That
would just spin until it ran out of memory lol.
But I did put receive outside the loop for a reason: it just
needs to prime the return value before it gets checked the
first time. But then, of course, it should receive again at the
end of the loop to advance to the next chunk.
do while would work better.