Home Help Center

Any Example that do file transfer out there

alexmalexm Member Eskinder Alex MesfinOrganization: Medtronic, Inc.Project: www.medtronic.com
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.

Comments

  • michimichi Member Michi HenningOrganization: Triodia TechnologiesProject: I have a passing interest in Ice :-) ✭✭✭
    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.
  • alexmalexm Member Eskinder Alex MesfinOrganization: Medtronic, Inc.Project: www.medtronic.com
    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.
Sign In or Register to comment.