Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Design Suggestions Needed!

Declan Conlon
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to monitor a file being uploaded, i.e. I want an upload progress bar to show how much of the file is on the server/or how much the client has actually sent.
Here's the two methods I have tried, see what you think.
1. Monitored the ammount of data the client has written to the DataOutputStream.
-Problem the stream does not send anything until the whole file is buffered; then sadly the file is in the virtual machines hands and I have no idea of the rate it is transferring the data to the server, thus no way to give an indication of file upload status.
2. Monitored the file's size on the serverside and wrote this back to the client.
-Problem here is that an InputStream on the client-side is not opened until it has fully uploaded the file to the server. Now a progress bar is made useless as the file has already been sent.
What I would like but can't seem to find;
a) A way to find out how much data is in the Virtual Machine's network buffer so I can determine how much data has been sent at any given point in time.
b) A way to have full duplex operation from client to server, i.e. a way to open a stream and get information from the server about the progress of that stream.
In my eyes Java's IO is very clumsy for seemingly such a simple task as this, however someone out there nust know of a way around these limitations.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic