Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Upload BandWidth  RSS feed

 
Kris Battula
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to determine the upload speed from a client machine to a server machine, can any one please tell me how do i do this using Java IO API?

Thanks!!
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, what is your protocol? Raw sockets, HTTP, FTP, etc?

I think all you can do is upload a largish number of bytes and see how long it takes. Depending on the protocol you may find connect and setup takes even longer than the data transfer, so be careful just what you time.

Speed is likely to vary wildly depending on what else is happening on the network. Somebody might be downloading gigabytes of web logs or transferring a database backup from one server to another. You just live with that; take many measurements and make a graph of typical timings.
 
Kris Battula
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Stan,

thanks much for the response. here is what exactly i am trying to achive. I have a web app which does aloow u to upload files from client's pc to the database. however the requirement is i need to show the approximate ammount of time it takes to upload the given file. i have implemented this in my offline (swing)app by sending/recieving a sample gif to server through the HttpsURLConnection and then calculating the time for the original file. i cant do the same here because i cann't grab a file from user's pc with out sendign one (security mesures). Please let me know if i can send some request to the server with some dynamic generated request and get the response. i appreciate your help/suggetions.

thanks!!
 
Kris Battula
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi stan,

sorry i forgot to mention, it is a http protocol
thanks
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't have a quick answer for that one. You might have a "check speed" button a user could push if they'd like an estimate and send something through the XMLHTTPService active-x control. I don't know if that would measure network speed or JavaScript speed or just what.
 
Kris Battula
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can i create a httprequest of certain size and send it across to the server and calculate the time taken to get the response. i want to determine the actual time depending on this...any ideas will be appreciated. is it feasible to generate a httprequest with out any real file??

thanks
kris
 
Paul Clapham
Sheriff
Posts: 22185
38
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is not possible to know how fast a file can be sent from Client A to Server B without actually sending data from Client A and Server B and measuring the result. And even timing an actual transmission has the usual pitfalls of a benchmark. In this case, the fact that the time to make the connection is greater than zero and the fact that data is sent in packets larger than one byte imply that you can't just send N bytes in M seconds and calculate the rate to be N/M bytes per second.

But if you just want a rough number, that's the way to go. The download controllers I've seen that predict the remaining time of a download based on the elapsed time so far and the number of bytes are pretty inaccurate anyway.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!