I'm having trouble figuring out where to put the "Send file" bit of an 
ftpserv component, and once that part is figured out, the best way to 
send the file data.

In one program, I have an FtpClient component..

GetFiles : array[1..10] of string;

GetFiles[1] := 'michael.dat';
(and so on)

then


FtpClient1.(all sorts of settings)

then I cheat (Francois probably won't like this bit)

if FtpClient1.open then
   if FtpClient1.User then
      if FtpClient1.Pass then
      begin
        for i := 1 to 10 do
        begin
          (re-set all of the FtpClient1.properties like FtpTst1's
           ExecuteCmd() does )

          FtpClient1.HostFileName := GetFiles[i];

          if FtpClient1.get then
             memo1.lines.add('Downloaded '+GetFiles[i]);
          else
             memo1.lines.add('Cant download '+GetFiles[i]);

        end;
      end;



Okay! Now on to the FtpServer..

Judging by the example (FtpServ1.pas) .. The best place to send the file 
is in the OnRetrSessionConnected event.. Here's what I tried to do, but 
found that it didnt work

var fil : file of byte;
     buf : array[1..2048] of byte;
     rec : integer;

(assign the datastream)..

assignfile(fil,client.FileName);
reset(fil);

repeat

    application.processmessages;

    blockread(fil,buf,sizeof(buf),rec);

    if rec > 0 then
      Client.DataStream.Write(Buf[1], sizeof(Buf));

until (rec=0) or (application.terminated);

closefile(fil);

Client.DataStream.Seek(0, 0);



And thatd be it. I get zero bytes transferred, and the ftp server itself 
locks up..

What's the better way to do this?
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to