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

Giganews Newsgroups
Subject: Re: New user: Cannot disconnect and reconnect on FTP Server Timeout.
Posted by:  Bjorn Heidarr (bjorn[AT]
Date: Fri, 19 Mar 2004


    A couple of cents for you regarding the server timeout:

    If you need the control channel to remain intact there are a few things
you can do to stop the timeouts:

    In 99% of all cases it is sufficient to send a NOOP command to the ftp
server on, for example, 1 minute interval.
  This will, with most FTP servers, keep the connection open and thus
eliminating the timeouts.
    NOOP does not do anything (NO OPeration). It simply sends a command to
the server, and the server replace with something like "220 command
successful". But atleast there is some activity through the control channel
which eliminates the timeout.

  Some FTP servers will not eliminate the timeout although the client sends
NOOP. Those server need activities via the data channel. In this case you
can send for example a LIST command on 1 minute interval.
  A "LIST notexisting.file" would do nicely in most of those cases... ;-)

    -- Bjorn Heidarr --

"Brendan Blake" <bbla…> wrote in message
> Hi all.
> I'm a new user, just trying to learn how to use Indy with Delphi5 to write
> simple FTP program.
> I've started from the demonstration program, and everything works fine
> 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
> (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
> IdFTP1.Connected set TRUE.  Thus attempts to Connect again fail.  I've
> 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
> the FTP component so I can reconnect?
> Brendan Blake.



In response to

New user: Cannot disconnect and reconnect on FTP Server Timeout. posted by Brendan Blake on Thu, 11 Mar 2004