title: Send huge file through RPC
body: <p>I'm developing an application client-server to send files using RPC but I have some problems on sending large file. I would like to allow the sender (client) to upload file of any dimension. My initial intention was to create on client side a struct containing the file (as a big string), the name of the file and the size, and then to send this to the server. This is the .x file:</p>
  
  <p>fileA.x</p>
  
  <pre><code>const MAXLEN = 1024;
  const FILELEN = 1000000000;
  typedef string my_file&lt;FILELEN&gt;;
  
  typedef char filename[MAXLEN];
  
  struct file_to_send {
   filename name;
   my_file data;
   int size;
  };
  
  program FILE_PROG {
    version FILE_VER {
      int sendFile(my_file) = 1;
    } = 1;
  } = 0x20000011;
  </code></pre>
  
  <p>The problem is that sending this struct (also imposing the limit of size FILELEN), I'm not able to send more than 106KB. How could I send any dimension of file? If a user send to the server 16GB of data, the problem could be the loading of the file on the struct and, on the server side,  the storing of the string on a file. For the first action I need to read the file and store it on a string, and for the second I need to read the string and store it on a file. I think there could be problems of memory. How could I avoid this?</p>