Re: Indy9: connect or passwort error

Giganews Newsgroups
Subject: Re: Indy9: connect or passwort error
Posted by:  David Goadby (dav…@dgoadby.demon.co.uk)
Date: Fri, 13 Aug 2004

Hi Heiko,

I am not sure what you mean so I assume you want to detect an ftp connect
exception. If I am wrong then please add some more detail about your
problem.

Wrap a Try/Except around your code something like the example below. You
will see that I filter the socket errors to get a finer level of detail. Not
all of the errors are easy to test so I have covered most of the likely
errors. I am
building a complete unit that will catch most of the socket errors for
easier re-use. In the meantime the code below should do the trick for you.

  Try
    FTP1.Connect();
  Except
    On EIdConnectTimeout do
          Memo1.Lines.Add('Connection timeout - no activity.');

    On EIdTFTPNoSuchUser do
          Memo1.Lines.Add('FTP User validation error - check Username &
Password.');

    On EIdSocksAuthError do
          Memo1.Lines.Add('FTP Socket Authorisation error - check Username &
Password.');

    On EIdSocksServerConnectionRefusedError do
          Memo1.Lines.Add('FTP Refused error - check Username & Password.');

    On EIdTFTPAccessViolation do
          Memo1.Lines.Add('FTP Access violation error - check Username &
Password.');

    On E: EIdSocketError do
      // check messge code
          if Pos('11001', E.Message) > 0 then
                Memo1.Lines.Add('FTP Site not found error - check site
URL.')
          else
                Memo1.Lines.Add('Unexpected Socket error - ' + E.Message +
'.');

    On E: EIdProtocolReplyError do
          Memo1.Lines.Add('Login Error - check Username and Password.');
  end;

"Heiko Rompel" <norep…@kohlroula.de> wrote in message
news:53F5F14B86A8E240norep…@kohlroula.de...
> hello,
>
> it is possible to select what kind of connection error
> a ftp-connection break?
>
> I will select "passwort-error" and "server not found",
> is this possible?
>
> greetings from
> heiko

Replies

In response to

Indy9: connect or passwort error posted by Heiko Rompel on Fri, 13 Aug 2004