cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

What the Max block size of C SDK filetransfer?

yhuang-21
1-Newbie

What the Max block size of C SDK filetransfer?

       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

8 REPLIES 8
supandey
19-Tanzanite
(To:yhuang-21)

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

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

supandey
19-Tanzanite
(To:yhuang-21)

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.

      Hi Sushant

      you are right that the lower limit is defined in C SDK code but not in  edge side.But there also have some question, when I add the  max_block_size to my code like blow and set the max_block_size in Thingworx platform 8000bytes , sometime it will execute the CancelFileTransfer  service although file transfer not Completed. And sometime it will "Time out attempting to read frame".I  also try to set the max_block_size in ThingWorx platform to 128k, it is always print the "Time out attempting to read frame".   What I miss configure some thing like timeout?  Could you tell me more about the file transfer configuration.

supandey
19-Tanzanite
(To:yhuang-21)

Yi, have you configured SSL on C SDK for connecting to platform? Could you please check the DEFAULT_SOCKET_READ_TIMEOUT or DEFAULT_SSL_READ_TIMEOUT configuration on C SDK? If they are set to default values you can try increasing the values to see if that helps.

I think it should address your issue if the connection is poor to the platform from C SDK or if simply the files are big and taking time to complete the transfer.

     Sushant, very thank you for your reply.

     I have just try your suggest to add the DEFAULT_SOCKET_READ_TIMEOUT or DEFAULT_SSL_READ_TIMEOUT value .

     when  I using a  twcfg.file_xfer_block_size bigger than 8000bytes, there also have the same error and  I must send a file bigger than 20 M.So, it is very unreasonable if it can only send file using the 8000bytes  block_size.  I also have tried  send file from my C SDK to the platform, and it can do it better. Not only it can use bigger block_size (15240bytes), but also it can send the block faster. I can not understand why? Both the send file function and get file function are invoking same twFileManager_TransferFile function!!??



posipova
20-Turquoise
(To:yhuang-21)

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.

  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;

 

Top Tags