• Post Reply Bookmark Topic Watch Topic
  • New Topic

measure download speed of internet  RSS feed

 
Zeeshan Ali Ansari
Greenhorn
Posts: 4
Android Linux Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi.... i want to measure internet current download speed .... how should i do it in java...
 
fred rosenberger
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
start a timer
download a file
stop timer
calculate speed.

Did you have a more specific question?
 
Zeeshan Ali Ansari
Greenhorn
Posts: 4
Android Linux Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how do we check if the file download is complete(automatic checking)....
is there any api that directly gives the dowload speed ....
 
Campbell Ritchie
Marshal
Posts: 56592
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To check completeness of download, you can obtain the size from the webpage, and use methods of the java.io.File class to check its size. For timing, look for posts like this one.
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

It's impossible to measure the download speed of the Internet, because there is no such thing. All you can do is measure the download speed from a specific server, and Fred already told you how to do that. As for the knowing when the download is complete - when the InputStream for it returns -1 when you call its read methods you're done.
 
Campbell Ritchie
Marshal
Posts: 56592
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can try going through the Java Tutorials looking for something about speed. I tried myself and didn’t find anything, however. Maybe the search facility will help.
 
Zeeshan Ali Ansari
Greenhorn
Posts: 4
Android Linux Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks ... i will try that
 
Campbell Ritchie
Marshal
Posts: 56592
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You’re welcome, and good luck with it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!