I am working on an Applet that uploads files to a web server using HTTP. I have a status bar that reflects how much of the file has been uploaded. However, it is very inaccurate as it does not allow for the time it takes for the file to travel of the netowrk.
I am trying to find a solution to this. I have one thought.
What if I access the information form the Network Transport layer to determine how many packets are to be sent and how many ACKs have been received. Is this viable? And is it possible to get this information using java??
posted 11 years ago
although a good idea, i don't think it is possible using java as the java api does not give you access to that level of detail.
another option might be to have the applet poll a servlet on the server side that tells the applet how much of the file it has received, using this information to update your progress bar. yet another option is to introduce a delay at the end of the file upload from the applet, waiting for the response to come back from the server. in this case you can at least ensure that the progress bar does not disappear before the file has been uploaded.