Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Feb : Re: idftp server with large files
| Subject: | Re: idftp server with large files |
| Posted by: | "Frankie" (frankjohnsson20..@yahoo.se) |
| Date: | Tue, 27 Feb 2007 10:48:27 |
Remy Lebeau (TeamB) skrev:
> "Frankie" <frankjohnsson2000@yahoo.se> wrote in message
> news:45e36267$1@newsgroups.borland.com...
>
>> procedure TfrmMain.ftpServerRetrieveFile(ASender:
> TIdFTPServerThread;
>> const AFileName: String; var VStream: TStream);
>> begin
>> try
>> VStream := TFileStream.Create(AppDir+'\'+AFilename,fmOpenRead);
>> end;
>
>> Thatīs it...
>
> That is all you need, although I would suggest specifying
> fmShareDenyWrite as well.
>
>> now i expect the file to be dowloaded to the client...but it
> doesnīt.
>
> Then you are doing something else wrong.
>
>> I got a hint from Remy that AppDir isnīt threadsafe...
>
> That is not what I was referring to. You were accesing a GUI
> component. THAT is what was not thread-safe. Your AppDir variable
> was local to the event handler. That is thread-safe.
>
>> so now it is a global variabel...
>
> That is definately not thread-safe if you are writing to it on each
> transfer.
Iīm not writing to it...just reading. Mainthread writes to it just
before started.
>
>> What am i doing wrong?
>
> You haven't provided enough details about your project to answer that.
>
In the "Indy9Demos_26Oct04" there is a FTP demo with a console FTP
server. I managed to crash that demo doing the same thing...smal files
are good (<20 Mb) but as soon i try to download a 350 Mb file...the
server will crash.
What is wrong with that demo?
>
> Gambit
>
>
/Frankie
none