Skip to main content
1-Visitor
December 9, 2016
Question

What the Max block size of C SDK filetransfer?

  • December 9, 2016
  • 2 replies
  • 4277 views

       I have a requirement to upgrade firmware to my device which  running C SDK. Now, I have make the file transfer work between C SDK application and ThingWorx platform. But question is that transfer speed is very low when I download a  bigger file from ThingWorx platform. And  I think the Max block size is reason!! I have try to set up the value of max block size in FileTransferSubsystem configuration, but it can't be set bigger than 8000 bytes.I mean whatever big value I set to it , the max always 8000 bytes when I transfer file~~

     If anyone know how to resolve this question, please let me know and show me what you have done!!!

     Thanks,

     yi

2 replies

5-Regular Member
December 9, 2016

Hi Yi, which version of ThingWorx and C SDK are you on?

yhuang-211-VisitorAuthor
1-Visitor
December 12, 2016

  My ThingWorx  version is ThingWorx 7.1.0-b4​84 , ​ and C SDK is c-sdk-1.3.1.957-release

5-Regular Member
December 12, 2016

Yi, i hope a lower limit is not defined on the edge side, since if the limit is lower on the edge it will have precedence over the block size defined in the ThingWorx platform.

20-Turquoise
December 13, 2016

FILE_XFER_BLOCK_SIZE changes the size of the blocks, and is defined in twDefaultSettings.h.

You can increase the size beyond the mentioned number, if you also increase the MAX_MESSAGE_SIZE setting as well.  For example, if you wanted to do a transfer of with block sizes of 64000, the following would allow this:

twcfg.max_message_size = 65536
twcfg.file_xfer_block_size = 64000

Messages greater that the 65535 threshold would be discarded, so you need to keep the block size beneath this value. The trade off here is in memory usage.  For the above settings, the application would end up buffering 64K messages before sending them.  You also could further increase these values in the example above if you can support the memory needs.

Also please note that the settings in the filetransfer subsystem (in the screenshot you show) will override the values on the edge side.

yhuang-211-VisitorAuthor
1-Visitor
December 14, 2016

  Hi Polina, thank you for your reply!!

  It is useful to increase both the MAX_MESSAGE_SIZE and file_xfer_block_size.  I can  transfer my file from my C SDK to ThingWorx platform with  a normal speed now(file_xfer_block_size can be 95K ).  But there still have some question when I download file from ThingWorx platform file repository. Whenever I increase the file_xfer_block_size more than 8000 bytes, just like blow and run my program, it always stop after invoking the GetfileInfo service and print such log. And then it will print   "Time out attempting to read frame", just I have post above~~   But it can transfer file  with a slow speed when I delete this code line!!

      twcfg.file_xfer_block_size = 10000;