Title: Sending large files using DataProvider Post by: markh51 on December 31, 2009, 04:08:06 PM I have implemented a RTC client / server application to allow the client to download large (~5mb) files. I have used the demos and the "lessons" to create these. When I download a file which is around 5mb, the file appears to be corrupt on the client side when the download is complete. The byte size of both files are the same however it does not open (its a zip file).
..BUT, if I download a zip file which is around 2-3mb, it works fine. It allows me to open the file on the client side with no problems. I have been looking at the code and I can not see a problem. I dont understand why I can download smaller files ~2mb but not ~5mb. The server app is running on a remote computer which is accessed through a vpn. The vpn connection is establised first. Can someone please help ? Thanks. Title: Re: Sending large files using DataProvider Post by: markh51 on January 01, 2010, 04:42:33 PM After a bit of support from zsleo, if figured out if I put a Application.ProcessMessages at the end of the DataIn/ResponseData event handler, the problem is fixed, but now I want to know why this is a "fix" for the problem.
Does anyone have any idea ?!? as surely this seems to be a problem as smaller files work fine without Application.ProcessMessages at the end. Title: Re: Sending large files using DataProvider Post by: markh51 on January 01, 2010, 08:15:19 PM After further investigation, I noticed that Application.ProcessMessages does not always work, however if I put a sleep(5) after the write_file it always works... any ideas what the problem is ?
Title: Re: Sending large files using DataProvider Post by: zsleo on January 03, 2010, 01:05:48 AM To which instance of Application.ProcessMessages are you referring?
In the sample app I provided, this is (my lasy way) implemented in place of implementing callbacks. P.S. If Application.ProcessMessages "fixes" the your problem I suspect that you are not correctly capturing/processing the multi-threaded calls Title: Re: Sending large files using DataProvider Post by: markh51 on January 09, 2010, 06:44:05 PM Code: procedure TMastData.RequestFileDataReceived(Sender: TRtcConnection); This is from your client side DataMod.pas file... When receiving a large file using very similar code I have to add a sleep(5) after the Write_File procedure otherwise the file is corrupt. BTW: My components are not set to "multi threaded" Title: Re: Sending large files using DataProvider Post by: D.Tkalcec (RTC) on January 09, 2010, 08:11:35 PM RTC SDK Client Lesson 1:
http://realthinclient.com/sdkarchive/indexd703.html RTC SDK File Client demo: "Demos\File_Client\File_Client.dpr" project in the RTC SDK package Best Regards, Danijel Tkalcec Title: Re: Sending large files using DataProvider Post by: D.Tkalcec (RTC) on January 09, 2010, 08:21:33 PM RTC Server Lesson 3 (http://www.realthinclient.com/sdkarchive/index00b300b3.html)
and Server Lesson 4 (http://www.realthinclient.com/sdkarchive/index86dc86dc.html). Server Quick Start Example 3+4 source code: "QuickStart\ServerLesson4\rtcServer4.dpr" in the RTC SDK package. RTC File Server demo: "Demos\File_Server\FileServer.dpr" in the RTC SDK package. Best Regards, Danijel Tkalcec Title: Re: Sending large files using DataProvider Post by: D.Tkalcec (RTC) on January 09, 2010, 09:08:54 PM I've now uploaded the exe compiled by using the project "QuickStart\ServerLesson4\rtcServer4.dpr" together with a 22 MB test ZIP file to my old Internet Server, configured the firewall on the Server to open the port used by the rtcServer4 project, started the "rtcServer4" project (it starts listening immediately), then went to my local PC and started the project from "Demos\File_Client", entered my Internet Servers IP address ("Server Address" edit field), entered the Port number ("Server Port" edit field), entered the name of that 22 MB zip file (which is now on the Server inside its "data" folder), checked the "Save to file" checkbox and clicked on the "POST" button. The file was then downloaded to my local PC into the "download" folder. I've then unpacked the received file and there were no errors.
I have tested this several times (deleted the file from the "download" folder before each test to make sure its not the old file) by using different options in the File_Client (Auto-Connect, Blocking, Multi-Threaded, Proxy, WinHTTP), the complete file was always received and the received file would always unpack without errors. PS. I was using the RealThinClient SDK 3.45 Best Regards, Danijel Tkalcec |