URL createInputStream timeout


How do you guys handle things if internet connection is terminated while downloading file for example.

I have URL input stream, reading from it and writing to file using writeFromInputStream().
If i manually disconnect from internet while downloading, after some time (timeout) i get input->isExhausted() == true.

On the other hand, I got the same status if file has been successfully downloaded as well.

How can i distinguish between these two situations?



Just found getTotalLength() function - comparing total downloaded bytes with total length solves the problem.