New user: Cannot disconnect and reconnect on FTP Server Timeout.

Giganews Newsgroups
Subject: New user: Cannot disconnect and reconnect on FTP Server Timeout.
Posted by:  Brendan Blake (bbla…@dsl.pipex.com)
Date: Thu, 11 Mar 2004

Hi all.

I'm a new user, just trying to learn how to use Indy with Delphi5 to write a
simple FTP program.

I've started from the demonstration program, and everything works fine until
I do nothing for a while and my FTP server times out.  In my case that is
after 15 minutes.

I've trawled through this forum, and understand that you don't get told
about the timeout until you try to do something else - that's fine. I can
trap the exception, which is an EIdProtocolReplyError with message "Timeout
(900 seconds): closing control connection."

OK - so all I want to do now is to tell the user, and also to reset and
allow the user to reconnect and carry on if that's what is wanted.

But I can't, for the life of me, find out how to disconnect and reset.
I've looked through more or less the whole forum and the Indy Help and FAQ
files for clues.  I note in one case being told all you have to do is
disconnect and reconnect.

But disconnecting (using Quit) doesn't work - there is a further exception
of class EIdSocketError with message "Socket Error #0", and it still leaves
IdFTP1.Connected set TRUE.  Thus attempts to Connect again fail.  I've tried
other methods such as Abort also without success.  I can't find a method
that sets everything back to the way it was at the start.

I am probably doing something stupid here - can anyone tell me how to reset
the FTP component so I can reconnect?

Brendan Blake.

Replies