Home Help Center

Transferring files/large data blocks

I would like to be able to pass (potentially large) files between a server and client using ice... I've tried using sequence<byte> and it worked just fine at first but when the files got to a few Mbs things stopped working... (I got an unknown exception from the remote operation)

My setup is something like this:

sequence<byte> ByteData;

interface Client {

void uploadFile( string filename, ByteData data );


interface Server {

void login( Client* cli );


// in client

server->login( client );

// in server

ServerI::login( ClientPrx client, ..... )
// read file data
client->uploadFile( filename, data );


This works for small files, eg the test file I used first was 71k...
For larger files I get "Unknown exception" in the server and ClientI::uploadFile is never reached on the client...

So, is there a recommended way to do this?


  • ganzuoniganzuoni Member Guido AnzuoniOrganization: IndividualProject: No specific project ✭✭
    I think that you should consider a chunked transfer approach.

    Something like:

    sequence<byte> ByteData;

    interface Receiver {

    void receive( ByteData data);
    void close();


    interface Server {

    Receiver *transfer( string filename);


    Your client will send multiple chunks of the original file
    invoking multiple receive() until EOF.

    I have used this approach in Java and it is really ***fast***
    (well, ftp is a little bit faster but....you have no objects !!)
    You can experience the performances using different chunk size.
    64K it is rather good.

    Hope it helps,

  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    Hmm... you shouldn't get an UnknownException, but instead a MemoryLimitException.

    You can increase the max message size by setting the property Ice.MessageSizeMax. The default is 1024, meaning 1024 KB = 1MB. Try setting it to a larger value, like 10240 = 10MB.

    For more information, have a look at the description of the MessageSizeMax property in the manual's reference section.

    If you would like to see an example for transferring arbitrary long files in "chunks", have a look at the code of IcePatch in src/IcePatch.
  • deeponedeepone Member
    Thanks... Good stuff... :)
Sign In or Register to comment.