This forum has been archived. Please start a new discussion on GitHub.

The right way to transfer raw bytes with ICE


What is the smart way of transferring large quantities of data between a client and a server with ICE?

One obvious way is to declare some suitable interfaces and implement their operations in the client and the server by means of, say, BSD-sockets.

I have seen some other threads about IcePatch on this forum, and it seems to me that there might be some significant amounts of functionality for data transferring already implemented in ICE.

What I need is a way to choose the protocols (UDP, TCP/IP) and specify the amount of data to be sent in each "packet".

Is there a suitable API for this purpose which is already implemented in ICE?

Perl bosts that there are many ways of doing things, Python boasts that there is only one way of doing things: the right way. Is there a right way of doing data transfer with ICE, or should I just settle for one of the many ways of doing it?



  • There are many ways to transfer files. If all your files are rather small, then just send them as a sequence of bytes. For example:
    sequence<byte> File;
    interface FileSender
        File getFile(string path);

    If your files get larger, then you might want to use something like this instead:
    sequence<byte> FileBlock;
    interface FileSender
        int getFileSize(string path);
        FileBlock getFile(string path, int pos, int size);

    In the latter case, you would first query the size of the file, and then get it in several chunks, like 10KB blocks.

    For file transfers, you should definitely use TCP. UDP is not reliable, and it also doesn't allow you to have any return values, meaning that you would have to implement a much more complicated "push" technology.