[twsocket] TFTPClient

Blaster blaster@blaster.nu
Sun, 25 Jun 2000 00:47:51 +0200


Hi Wilfried...

I think i'm closing it right? this is what i do:

procedure TfrmMain.FTPBgException(Sender: TObject; E: Exception;
  var CanClose: Boolean);
begin
 LogEvent('Exception Error: '+E.Message);
//  UpdateIni(Hosts[hID].DataFile, IDENT_LAST_ERROR, DateToStr(Date)+' -
'+TimeToStr(Time)+': FTP Session timed out');
 CanClose := False;
 if FTP.Connected then FTP.QuitAsync else
  NextFTP;
end;

--------------------------------------------------------
this is my requestdone event:
--------------------------------------------------------
procedure TfrmMain.FTPRequestDone(Sender: TObject; RqType: TFtpRequest;
  Error: Word);
begin
 Application.ProcessMessages;
 if Error <> 0 then begin
//  UpdateIni(Hosts[hID].DataFile, IDENT_LAST_ERROR, DateToStr(Date)+' -
'+TimeToStr(Time)+': '+FTP.ErrorMessage);
  UpdateIni(Hosts[hID].DataFile, IDENT_LAST_ERROR, 'This feature has been
disabled for further use.');
  FTP.QuitAsync;
 end else begin
  case RqType of
   ftpNone : LogEvent('FTP.RequestDone: None');
   ftpOpenAsync : begin
                   LogEvent('Connected to '+Hosts[hID].Alias+', sending
username..');
                   UpdateIni(Hosts[hID].DataFile, IDENT_LAST_CONNECT,
DateToStr(Date)+' - '+TimeToStr(Time));
                   FTP.UserAsync;
                  end;

   ftpUserAsync : begin
                   FTP.PassAsync;
                  end;

   ftpPassAsync : begin
                   LogEvent('Logged on to '+Hosts[hID].Alias);
                   UpdateIni(Hosts[hID].DataFile, IDENT_LAST_LOGON,
DateToStr(Date)+' - '+TimeToStr(Time));
                   FTP.QuitAsync;
                  end;
   ftpQuitAsync : begin
                   //Now we are entirly disconnect, connect to next FTP in
order..
                   LogEvent('Disconnected from '+Hosts[hID].Alias);
                   NextFTP;
                  end;
  end;
 end;
end;


Wilfried Mestdagh wrote:

> Blaster,
>
> You probably forgot to close the connection if your timeout expires (or
> forgot to wait until it is closed [requestdone]).
>
> rgds, Wilfried
>
> > -----Original Message-----
> > From: twsocket-admin@elists.org [mailto:twsocket-admin@elists.org]On
> > Behalf Of Blaster
> > Sent: zaterdag 24 juni 2000 22:24
> > To: twsocket@elists.org
> > Subject: [twsocket] TFTPClient
> >
> >
> >
> > Hi!
> >
> > I'm having troubles when using the TFTPClient component in the ICS
> > Suite.
> > My application goes through this list of FTPs and checks if they are
> > valid or not (if they are connectable). If a site is down or does not
> > responds it automaticly disconnects and tries the next in the FTP list..
> >
> > I've chained my procs with the OnRequestDone function.
> >
> > However, when the app comes to a ftp that does not respond and timesout
> > it doesn't work no more. It looks right (it displays a timeout error
> > message and tries
> > the next ftp in order) but all ftps after the one that failed gets the
> > exact same error.
> > I then tried to connect to the ftps after the one that failed with a
> > normal ftp
> > client and this worked fine.
> >
> > At some point the FTP component gives me Exception error
> > "FTP Component not ready".... (after the the one that failed that is)
> >
> > What am I doing wrong?
>
> _______________________________________________
> TWSocket mailing list [http://elists.org/mailman/listinfo/twsocket]
> Visit our website at http://www.rtfm.be/fpiette/indexuk.htm