EIdConnClosedGracefully Moved From IndyInDepth

Giganews Newsgroups
Subject: EIdConnClosedGracefully Moved From IndyInDepth
Posted by:  Robert Tulloch (tulta…@attglobal.net)
Date: Mon, 28 Mar 2005

Hi:

I am attempting to connect with no internet connection and getting this
excpetion.

      The server side of this connection has disconnected normaly but
your client has attempted
      to read or write to the connection. You should trap this error
using a try..except.
      Please see the help file for possible further information.

      // ************************************************************* *)
      raise EIdConnClosedGracefully.Create(RSConnectionClosedGracefully);

----------------------------------------------------------

I tried:

    try
      SMTP.Connect;
    except
      on E: Exception do
        begin
          if E is EIdConnClosedGracefully then
            begin
              ShowMessage('The Client failed to connect to the mail
server. Perhaps there is no ' +
                          'connection to the internet. Please verify
that you have an active connection.');
              if SMTP.Connected then
                begin
                  SMTP.Disconnect;
                  StatusBar.Panels[2].Text := 'Disconnected';
                  exit;
                end;
            end
          else
            Raise;
        end;
    end;

And I don't trap the exception.

Any suggesytions as to why?

Thanks.

Replies