I have a Java program that downloads a file from a server, using 8 parallel connections. The file is downloaded in 8 parts and assembled at the end. How can I calculate the remaining time of downloading?
first try to calculate download speed over 5-10 second period like
speed
= downloaded_bytes_from_all_8_connections_in_last_10seconds
/10
it'll give you average speed over last 10 seconds
now just use simple math to get the remaining time,
remaning_number_of_seconds
= total_remaining_bytes
/speed