Test Results

About us

 3.18 Client sending large files
Total posts: 2
 Author 3.18 Client sending large files
Kevin Powick

25.02.2009 20:31:48
Registered user
I see that 3.18 addresses issues with trying to send files over 1GB in size via the HTTPCLient component.

While I suppose it's good that the issues are solved, isn't it a really poor design to try and send such a massive file in "one shot"?  Shouldn't the proper approach be to break the file down into smaller pieces and send those, or does the SDK now handle this automagically?


Kevin Powick
Danijel Tkalcec [RTC]

25.02.2009 21:51:41
Registered user
Hi Kevin,

because of a lack for a better idea to emulate event-driven operation when using synchronous client-side WinInet and WinHTTP APIs, the "DataSent" event was being indirectly called from other methods called by the "DataSent" event in order to get a "sending loop" working in a similar manner it does with the asynchronous WinSock API. To get the code working "in a similar manner" with asynchronous APIs as it does with synchronous APIs was necessary in order to make client-side code written with the RTC SDK work the same regardless of the low-level API being used.

But that implementation was not meant to be used for sending large amounts of data in a single request, so anyone who would try to use the TRtcHttpClient component to send out a large file would either be hit by a "stack overflow" error when splitting the file into smaller blocks and sending one block at a time from "DataSent" events, or cope with high memory requirements when trying to send large chunks of the file in less Write calls in order to avoid flooding the stack with recursive "DataSent" events.

And now, I have found a way to change the "recursive" implementation into one that uses a loop on the lowest chain level, keeping the general idea and functionality as it already was (so there is no need to make any changes in any code using the RTC SDK), while eliminating the need for extra space on the stack when the Client needs to split its requests into smaller chunks (for example, when uploading large files to the Server).

As for the question if it is necessary to send a large file out in a single request, or if it would be better to split the file in smaller blocks and send each block in a separate request, I am sure every developer will have his own opinion. For me, it was only important to offer this as a choice.

For example, one might be forced to work with a third-party Web Server which uses PUT or POST requests for accepting files and requires the user to send each file in a single HTTP request (not split files apart). With this recent update to the RTC SDK, it is possible to accommodate that requirement.

Best Regards,
Danijel Tkalcec