Hi Gaspar,

If you use some of the approaches that let HTTPClient do all the hard work for you, you'll not have this feedback as far as I'm aware.

But it's quite simple to get this information yourself. If you open the connection and read data as a stream, you need to remember :

* the time (e.g. System.currentTimeMillis()) you started as a "long" variable

* the total number of bytes so far read as a "long" variable, updated each time you read some bytes from the stream

* you can determine the average speed so far by dividing the number of bytes downloaded by the time taken so far (see both points above); that's not necessarily your current speed

* for the percentage remaining, you'll need to know in advance the size of what you're going to download (the HTTP response header "Content-Length" should help here, but you're not always going to get this information, and it's not always provided correctly by the server).

You'll want multithreading no doubt, so make your "download" object expose this information through "getter" methods. You can then display this on the command line, in a progress bar, or whatever.

- Chris


From: "Gaspar" <[EMAIL PROTECTED]>
Reply-To: "HttpClient Project" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Subject: How i can get information about the downloading process?
Date: Sat, 6 Nov 2004 16:08:35 -0800

Hi,

My question is about how i can do with HttpClient, something that i see on
many download manager software.

About the file that i'm downloading using HttpClient i want to get this
information:

- % of the file that is downloaded already.
- the size of what is downloaded already.
- the speed rate(b/s) of what is downloading.
- the time left to finish the download process.

the downlaod manager that i use is ReGet Deluxe 3.3 and i want do something
similar with HttpClient.

Thanks in advance,
Gaspar




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]


_________________________________________________________________
MSN Actions Solidaires : volontaire � l'�tranger http://www.msn.fr/actionssolidaires/Default.asp?Ath=f



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to