Solved

How to detect Internet speed ??

Posted on 2002-05-19
3
185 Views
Last Modified: 2011-09-20
I have a pure java program and it will downlod some file from server. When it download files from server, simetime it will take long time if files size is big. I plan to use JProgressBar to show user the progress. But I have a problem to calculate the total time for download. Actually I have below two question:
1) how to detect the Internet speed
2) how to get file size in server side--suppose I have URL for file in server side.

If I can handle above two problems, I can get total download time. Then I can use JProgressBar. Tahnks
gary
0
Comment
Question by:garyshi
3 Comments
 
LVL 92

Accepted Solution

by:
objects earned 50 total points
ID: 7020554
> 1) how to detect the Internet speed

The only way to get this is to calculate it by tracking the number of bytes recieved and the time taken to recieve them. And even then it is only an estimate, plus it's always changing.

> 2) how to get file size in server side--suppose I have
> URL for file in server side.

Try using getCOntentLength() method of URLConnection.
0
 
LVL 35

Expert Comment

by:girionis
ID: 8766861
No comment has been added lately, so it's time to clean up this TA.

I will leave a recommendation in the Cleanup topic area that this question is:

- points to objects@idg

Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

girionis
Cleanup Volunteer
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This video teaches viewers about errors in exception handling.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now