File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 15632

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.
Consider Paul's rocket mass heater.
subject: How can I know the transfering progress in RMI
Similar Threads
Byte array manipulation
sending an encrypted byte array through a socket
Reading byteArray at Client side
sending pdf file to client as byte array
How to convert byte array to string array ?