procedure TMastData.RequestFileDataReceived(Sender: TRtcConnection);
var
s
:string;
begin
with TRtcDataClient(Sender) do
if not inMainThread then
Sync(RequestFileDataReceived)
else
begin
gv_FetchCnt := 0;
if Response.Started then
begin
if Request.Query.asString['fname']<>'' then
begin
if not DirectoryExists(ExtractFilePath(ExpandFileName(Request.info.asString['fname']))) then
CreateDir(ExtractFilePath(ExpandFileName(Request.info.asString['fname'])));
Delete_File(Request.Query.asString['fname']);
end;
end;
if Request.Query.asString['fname']<>'' then
begin
s:=Read;
Write_File(Request.Query.asString['fname'], s, Response.ContentIn-length(s));
end;
end;
Application.ProcessMessages
end;
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"