ElStevo
ElStevo

Reputation: 71

Pharo: download file in parallel chunks

I'm trying to download a large file in chunks, with each chunk downloaded in parallel with the others. All chunks would be combined at the end.

However, from my understanding, Pharo's basic threading interleaves instead of being truly parallel, meaning one chunk has to wait for the previous to finish.

Is there a way to accomplish something like this?

Note: apologies for lack of code. I had a "working" project, but I don't have access to that code at the moment.

Upvotes: 1

Views: 127

Answers (1)

James Foster
James Foster

Reputation: 2210

one chunk has to wait for the previous to finish

The key is that with non-blocking sockets you don't have to wait for a chunk to finish. Look for something like SocketStream>>isDataAvailable and SocketStream>>nextAvailable and read only what is available without blocking.

Upvotes: 2

Related Questions