Archived
This forum has been archived. Please start a new discussion on GitHub.
Any Example that do file transfer out there
in Help Center
I 've looked through previous posting regarding file transfers, did'nt worked well for me in IcePy, so I am wondering if any examples out there I can try out as a strtup.
0
Comments
-
For files up to a few megabytes in size, you can just send them in a single RPC. Something like
sequence<byte> ByteSeq;
interface FileStore
{
ByteSeq get(string name);
void put(string name, ByteSeq s);
};
should do nicely. Just remember to set up Ice.MessageSizeMax to a value large enough to accommodate the largets file. (The default is 1MB.)
For really large files, in the tens or hundreds of MB, you will have to to transfer the file in chunks instead. Just make yourself an interface that delivers the file in, say, 1 MB lots, one after the other.
Cheers,
Michi.0 -
Hi
Is the snipet of Slice below:sequence<byte> ByteSeq;
interface FileStore
{
ByteSeq get(string name);
void put(string name, ByteSeq s);
};
I implemented as follows:
in client
def get( filename):
fd = open( ...)
buffer = fd.read( 10240)
fd.close()
return buffer
In server
buffer = proxy.get( filename)
I get the followin Error:
On server
Traceback (most recent call last):
File "/malu/abelo/bin/coServer.py", line 42, in initiateSender
buffer = proxy.get( 10240, current.ctx)
File "/malu/abelo/coClientServer.ice", line 87, in cliRead
UnknownException: exception ::Ice::UnknownException
{
unknown = exceptions.ValueError: invalid value for element 0 of sequence<byte>
}
Shutting down...
on the client
echos the server error.
How do I use/ capture the ByteSeq in my client/callback.0