On Friday, 6 February 2015 at 00:31:37 UTC, Gan wrote:
Or am I misunderstanding the receive function? Does it send whole messages or just message chunks?

It sends as much as it can when you call it. So if there's only 12 bytes available when you send it with a 4096 buffer, it will fill the first twelve bytes (and return 12) so you can slice it buffer[0 .. returnedValue] to get the data.

If there's more available than the buffer will hold, that data will be held on to until next time you call receive. If 5000 bytes come off the network, it will return 4096 the first time, then next time through the loop, it will return the remaining 904.

Reply via email to