Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Netzwerke (https://www.delphipraxis.net/14-netzwerke/)
-   -   Delphi Indy FTP Client Read Error (TidFTP) (https://www.delphipraxis.net/107226-indy-ftp-client-read-error-tidftp.html)

FaNIX 24. Jan 2008 12:34


Indy FTP Client Read Error (TidFTP)
 
Hi,

I wonder if anyone can help me with this. I have a simple FTP procedure, which downloads a single file form a FTP server.

The procedure works fine, but this is my issue:

I'm using Windows XP, and as some of you know, it has a default internal firewall, just like Vista (Security Center). Now the first time the application tries to access the FTP server, windows pops up the Firewall warning, asking to Allow this application.

[IMG]
http://img143.imageshack.us/img143/7642/indy2pf4.jpg
[/IMG]

Once i click yes, the FTP doesn't continue to download the file, it just stops, then i get the following error in delphi:

[IMG]
http://img292.imageshack.us/img292/9210/indyrn9.jpg
[/IMG]

Now if i restart the application, the download works fine, because the application was added to the windows firewall allow list. Does anyone know how to get past this error, so that it continues to transfer the file? Any help would be much appreciated.

Regards

Klaus01 24. Jan 2008 12:42

Re: Indy FTP Client Read Error (TidFTP)
 
Hi,

can you increase the timeout value for the ftp client?
Because the ftp transfer was running into a timeout.
It took to long to add the application to firewall access list.

Best regards
Klaus

FaNIX 24. Jan 2008 12:48

Re: Indy FTP Client Read Error (TidFTP)
 
Zitat:

Zitat von Klaus01
Hi,

can you increase the timeout value for the ftp client?
Because the ftp transfer was running into a timeout.
It took to long to add the application to firewall access list.

Best regards
Klaus

Yes thats what I also though, and so i did the following, but it still doesn't work:

oFtp.TransferTimeout := 10000;
oftp.ReadTimeout := 10000;

Klaus01 24. Jan 2008 13:34

Re: Indy FTP Client Read Error (TidFTP)
 
Hello again,


I'm not sure if we can catch the problem just by increasing the timeout value.
The problem is that your application does not know if it is blocked by a firewall
or the ip connection is down or something else.

A better approach might be to act on the Exception EidReplyRFCError or EidReadTimeout.
Then you start the transfer again, or you can pop up a message
that a problem has occured and the user has to check this and that.
After the message has been acknowledged the application can try to
do the transfer again.

In that case the user has enough time to allow the firewall to pass the
ftp transfer.

Bye,
Klaus

FaNIX 24. Jan 2008 14:01

Re: Indy FTP Client Read Error (TidFTP)
 
Zitat:

Zitat von Klaus01
Hello again,


I'm not sure if we can catch the problem just by increasing the timeout value.
The problem is that your application does not know if it is blocked by a firewall
or the ip connection is down or something else.

A better approach might be to act on the Exception EidReplayRFCError or EidReadTimeout.
Then you start the transfer again, or you can pop up a message
that a problem has occured and the user has to check this and that.
After the message has been acknowledged the application can try to
do the transfer again.

In that case the user has enough time to allow the firewall to pass the
ftp transfer.

Bye,
Klaus

mmm ok, that might work, but how do i catch the EidReplayRFCError or EidReadTimeout exceptions?

Klaus01 24. Jan 2008 14:07

Re: Indy FTP Client Read Error (TidFTP)
 
You can use the try except things to this:

Delphi-Quellcode:
try
// do some stuff
except on e:EIdReplyRFCError do
  begin
    // do exception handling
  end;
end;

FaNIX 24. Jan 2008 14:28

Re: Indy FTP Client Read Error (TidFTP)
 
Zitat:

Zitat von Klaus01
You can use the try except things to this:

Delphi-Quellcode:
try
// do some stuff
except on e:EIdReplyRFCError do
  begin
    // do exception handling
  end;
end;

[DCC Error] u_CAV_Check.pas(373): E2003 Undeclared identifier: 'EIdReplyRFCError'

:(

Klaus01 24. Jan 2008 14:33

Re: Indy FTP Client Read Error (TidFTP)
 
Have you added idException to your uses statement?

FaNIX 25. Jan 2008 06:40

Re: Indy FTP Client Read Error (TidFTP)
 
Zitat:

Zitat von Klaus01
Have you added idException to your uses statement?

Yes I have done that, but it seems that there isn't such a exception type.

Klaus01 25. Jan 2008 07:54

Re: Indy FTP Client Read Error (TidFTP)
 
Good morning,

I've looked into the source code of indy 10, idException.pas, and you are right
EidReplyException is not definded there.

But it is defined in idReplyRFC.pas, may you have to add this unit to your uses clause.
Don't ask me the idReplyRFC is not included in idException, thats some kind of strange to me.

Cheers,
Klaus


Alle Zeitangaben in WEZ +1. Es ist jetzt 14:33 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz