Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Feb : Re: idftp server with large files
| Subject: | Re: idftp server with large files |
| Posted by: | "Remy Lebeau (TeamB)" (no.spam@no.spam.com) |
| Date: | Mon, 26 Feb 2007 18:15:47 |
"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.
> What am i doing wrong?
You haven't provided enough details about your project to answer that.
Gambit