Re: TidFTP problems

Giganews Newsgroups
Subject: Re: TidFTP problems
Posted by:  Alan Olson (aols…@wi.rr.com)
Date: Fri, 11 Jun 2004

Also, i'm using Delphi 7 on Windows XP.

alan

"Alan Olson" <aols…@wi.rr.com> wrote in message
news:E09ED3F4ACA0E240aols…@wi.rr.com...
> I'm using Indy 9.0.14, the latest version released.  I have an application
> that need to repeatedly throughout the day check an FTP site and download
> any "new" files.  These files are small (1-2K) XML files.
>
> Occasionally, if there are a lot of files to grab at one time (~150 or
> more), in my download loop within my thread i get the following sequence
of
> exceptions:
>
> [9:37:38 AM] Exception: Socket Error # 10054 Connection reset by peer.
> [9:37:38 AM] Exception: Socket Error # 0
> [9:37:38 AM] Exception: Connection Closed Gracefully.
>
> obviously, this requires me to reconnect and finish my loop of downloads.
>
> here is the snippet of code in my thread which does the downloads.  I
added
> the first try/except block after i was getting 10054 errors, and obviously
i
> still am getting those errors.
>
>                for x := 1 to FileList.Count do
>                    if not(Terminated) then
>                        try
>                            DLStream.Clear;
>                            //cs.SendInteger('Calling Get for ad #',x);
>                            try
>                                ftp.CheckForDisconnect(True,False);
>                            except
>                                  on E: Exception do
>                                      Begin
>                                          ErrorString := e.Message;
>
> PostMessage(MainHandle,NYT_DL_EXCEPTION,0,0);
>                                          FTP.Connect;
>                                      end;
>
>                            end;
>
>                            try
>                                FTP.Get(FileList[x-1],DLStream);
>
DLStream.SaveToFile('FILES\'+FileList[x-1]);
>
> PostMessage(MainHandle,NYT_DL_AD_MESSAGE,x,0);
>                            except
>                                  on e: exception do
>                                      Begin
>                                          ErrorString := e.Message;
>
> PostMessage(MainHandle,NYT_DL_EXCEPTION,0,0);
>                                      end;
>                            end;
>                        finally
>                              sleep(1);
>                        end;
>
> Why would this happen?  These are small files, and as i understand it, an
> ftp connection should not be dropped by the server.  Any suggestions of
how
> to resolve this?
>
> thanks,
>
> Alan Olson

Replies

None

In response to

TidFTP problems posted by Alan Olson on Fri, 11 Jun 2004