• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Design Suggestions Needed!

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
If you settle for what they are giving you, you deserve what you get. Fight for this tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic