Board index » cppbuilder » IdFTP1->List problem
David Ayre
![]() CBuilder Developer |
David Ayre
![]() CBuilder Developer |
IdFTP1->List problem2007-02-14 09:18:09 PM cppbuilder54 Hi, I am using Indy 9 with BDS 2006 but have found a problem with the ftp module when I use IdFTP1->List(SL,"",false); If there is nothing in the folder it crashes. What can I do to avoid this? Cheers, David |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
2007-02-15 02:02:53 AM
Re:IdFTP1->List problem
"David Ayre" < XXXX@XXXXX.COM >wrote in message
QuoteI am using Indy 9 with BDS 2006 but have found a problem "borland.public.delphi.internet.winsock" newsgroup from last night. Gambit |
David Ayre
![]() CBuilder Developer |
2007-02-15 06:07:01 PM
Re:IdFTP1->List problem
"Remy Lebeau \(TeamB\)" < XXXX@XXXXX.COM >wrote:
Quote
If the server gives the wrong response to IdFTP1->List(SL,"",false); for an empty folder, how can I detect this and continue, ignoring the List(), which would then be unnecessary? David {smallsort} |
Tom
![]() CBuilder Developer |
2007-02-15 10:41:17 PM
Re:IdFTP1->List problemQuoteIf the server gives the wrong response to IdFTP1->List(SL,"",false); the exceptions and deal with them accordingly. If an exception isn't thrown, you should check the response code that is returned and determine your action from there. Regards, Tom |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
2007-02-16 01:38:42 AM
Re:IdFTP1->List problem
"David Ayre" < XXXX@XXXXX.COM >wrote in message
QuoteI've had a look at the NLST discussion but couldn't glean Gambit |
David Ayre
![]() CBuilder Developer |
2007-02-16 02:57:23 AM
Re:IdFTP1->List problem
"Tom" < XXXX@XXXXX.COM >wrote:
Quote>If the server gives the wrong response to IdFTP1->List(SL,"",false); to set it out. Could you possibly give me a code example. Cheers, David |
Tom
![]() CBuilder Developer |
2007-02-16 09:53:17 AM
Re:IdFTP1->List problem
David,
Without knowing the exact exception that's being thrown, I can only give you a general try catch example. Once you get the exception name I would only catch that exception so you can deal with any others that may show up accordlingly. try { IdFTP1->List(SL, "", false); } catch (Exception &e) { // This will catch every exception and handle them the same // way. If you have different exceptions coming up, you need to // catch them separately by using the proper names. // IE: catch (EIdSocketError &e) or catch (EIdProtocolReplyError) // If you need to do something special, put that code here. // otherwise the error message will disappear. Please remember // that the error will still be shown if you're using the de{*word*81}. } Regards, Tom |
David Ayre
![]() CBuilder Developer |
2007-02-16 10:25:54 PM
Re:IdFTP1->List problem
Thanks Tom,
That seems to have solved the problem. Cheers, David "Tom" < XXXX@XXXXX.COM >wrote: QuoteDavid, |
David Ayre
![]() CBuilder Developer |
2007-02-19 03:06:35 AM
Re:IdFTP1->List problem
"Remy Lebeau \(TeamB\)" < XXXX@XXXXX.COM >wrote:
Quote
the List() into a try/catch and allowed it to ingore the return when there was an empty folder. Now I can check the return and make it more specific. Thanks for your help. David |