Meaningless Drivel is fun!*
The moose likes Distributed Java and the fly likes How can I know the transfering progress in RMI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "How can I know the transfering progress in RMI" Watch "How can I know the transfering progress in RMI" New topic

How can I know the transfering progress in RMI

Jack Deng

Joined: May 29, 2004
Posts: 23
I convert a large file to byte array on server side, and transfer it to client side. I want to build a progress indicator,can any one give me some advices, if you can provide sample code, it would be great. or I don't mind to use an alternative other than simply send the whole file's byte array to the client.

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15960

The same way you'd do it with files. Define an RMI method that returns the amount of data that will be transferred and another RMI function that works like the C file fread/fwrite functions do in other to transfer the data in small chunks. That way, as the chunks come over you can easily calculate how much data remains and plot it on a progress bar and/or print a "% complete" message.

You couldn't do this if you attempted to transfer the entire data stream in a single method call, since from the application program's point of view, and RMI call is an atomic operation.

Customer surveys are for companies who didn't pay proper attention to begin with.
jQuery in Action, 2nd edition
subject: How can I know the transfering progress in RMI
Similar Threads
How to convert byte array to string array ?
sending pdf file to client as byte array
Byte array manipulation
Reading byteArray at Client side
sending an encrypted byte array through a socket