How can I develop a File transfer application?question 1

in Help Center
question 1 ,how can I transfer a file via Ice?
A file may be text file,picture file,or other binary file.
I look up the Ice pdf.But have no idea of how to transfer them.
The Basic Slice Type I can use is "byte",maybe I should slice
the file into "byte" data and transfer it?Is there any better way?
can you tell me the main point?
---development platform
vc 7.1
win2000 professional simplified chinese
ice 1.20
A file may be text file,picture file,or other binary file.
I look up the Ice pdf.But have no idea of how to transfer them.
The Basic Slice Type I can use is "byte",maybe I should slice
the file into "byte" data and transfer it?Is there any better way?
can you tell me the main point?
---development platform
vc 7.1
win2000 professional simplified chinese
ice 1.20
0
Comments
I've successfully implemented something similar to this using an earlier version of ICE.
What I did was create a SLICE definition similar to this:
I then created a server which would create a sequencially named file everytime the jfsUpload method is invoked. The server writes the passed parameter to the file. The client just opens the file as binary and pass its contents as parameter to the method. Works like a charm.
There a catch though, the older version of ICE only supports up to 1MB of data to be transfered per request. Since I was transfering data in the 8MB range per call, I asked for tech support and Marc Laukien was kind enough to point me in the right direction:
I haven't tested if ZeroC have implemented the property mentioned above in ICE 1.2 since the sample code was used in our prototype and were currently in design stage for the actual project.
Hope this helps.
Alex
If the files are very large, it might still make sense to transfer them in chunks of data, like IcePatch does.
I have used a classical stream approach with the following definition:
module io {
sequence<byte> IOBuffer;
exception IOException {
string message;
};
exception EOFException extends IOException {
};
interface StreamSink {
void write(IOBuffer bytes) throws IOException;
void close() throws IOException;
};
interface StreamSource {
IOBuffer read(long nbytes) throws IOException;
void close() throws IOException;
};
interface RemoteDir {
StreamSource *open(string name) throws IOException;
};
};
Using 64Kb buffer it's rather fast and gives no troubles on max message size.
It is also trivial to write a Java InputStream adapter for a StreamSource and
an OutputStream for a StreamSink so you can, for example, unzip
a remote file....
Regards,
Guido.
thank you,Alex
thank you,Guido
you are so kind!!!
A good news is that My application of file transfer can work with your help!
now I try to make it better.
Hi!
It is a while now since I read the Ice documentation, and I can not remember where Icepatch is documented. It isn't listed in the table of contents either (or am I blind?).
Is Icepatch an API for transfering files, or it just happens that in doing whatever Icepatch does, it needs to transfer files so it implements an example of how to do it?
If it is an API for file transfer, is it configurable, like choosing which protocol to use (I guess UDP, TCP/IP and SSH are available), the size of the packets to send, setting timers and so on.
Thanks,
Catalin
IcePatch is really three things:
For an example on how to use icepatchserver and icepatch client, see:
http://www.zeroc.com/vbulletin/showthread.php?threadid=254
It seems to me then that IcePatch is a kind of file synchronization mechanism. What was the motivation behind it?
I can also see that it is implemented by quite a voluminous amount of code, IcePatch.cpp alone amounts to something like 2643 lines.
Can I turn off the compression mechanism? If a file is already compressed, say a JPEG picture, it won't compress any significant more by running it again through a compression mechanism. If I am wrong about JPEG pictures I guess I still am right about an already compressed .gz file.
Can you tell more about the library which can be used to build own clients? Which features does it have?
Thanks
Catalin
It is used for patching software products. For example, Mutable Realms uses IcePatch for their game client: If a user connects to the game server, the game client is first updated with the latest patches.
Well, it also does a lot of stuff. If all you want is a simple point-to-point file transfer, then IcePatch is an overkill.
Not without changing the code.
It's bascially a set of utility functions that check MD5 files, uncompress, get files from the IcePatch server, show download progress using callbacks, etc. Have a look at Client.cpp for how the library can be used.
I am studying the IcePatch .I can built the IcePatch server source code in ICE-1.2.0\src\IcePatch. But I have a problem when i run it. It appear a memory error dialog.why?How can solute it? Thank you!!!