8 Replies Latest reply on Dec 13, 2016 10:14 PM by yhuang-2 RSS
    yhuang-2 Explorer

    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

      • Re: What  the Max block size of C SDK filetransfer?
        supandey Collaborator

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

          • Re: What  the Max block size of C SDK filetransfer?
            yhuang-2 Explorer

              My ThingWorx  version is ThingWorx 7.1.0-b484 , and C SDK is c-sdk-1.3.1.957-release

              • Re: What  the Max block size of C SDK filetransfer?
                supandey Collaborator

                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.

                  • Re: What  the Max block size of C SDK filetransfer?
                    yhuang-2 Explorer

                          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.

                     

                      • Re: What  the Max block size of C SDK filetransfer?
                        supandey Collaborator

                        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.

                          • Re: What  the Max block size of C SDK filetransfer?
                            yhuang-2 Explorer

                                 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!!??



                  • Re: What  the Max block size of C SDK filetransfer?
                    polinao Ninja

                    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.

                      • Re: What  the Max block size of C SDK filetransfer?
                        yhuang-2 Explorer

                          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;