Board index » delphi » about indy Tidftp vcl(indy8. delphi5)

about indy Tidftp vcl(indy8. delphi5)

hi all,

i have questions about TidFtp componnet.

when i use it to connect to a ftp.. i do this..

if (not ftp.connected) then ftp.connect..

but will failed when server kick me out or server time out.

then i change to :

<------------------------------------------

  procedure ConnectToFtp(SiteName: string; AFtp: TIdFtp);
  begin
    Retry := 3;
    FtpConnected := False;
    while Retry > 0 do begin
      try
        Log(SiteName + '.Logon');
        try
          AFtp.CheckForDisconnect(True, False);
          AFtp.CheckForGracefulDisconnect;
          AFtp.Noop;
          FtpConnected := True;
        except
          FtpConnected := False;
        end;
        if not FtpConnected then
          AFtp.Connect;
        Log(SiteName + '.Logoned');
        Retry := 0;
      except
        Dec(Retry);
        Log(SiteName + '.Retry');
        Sleep(1000);
        Self.Synchronize(Application.ProcessMessages);
        AFtp.Disconnect;
        if Retry = 0 then raise Exception.Create(SiteName +
'.Login.Failed');
      end;
    end;
  end;

------------------------------------------->

but sometimes still will error with a winsock error "xxx.. refused.."
or other message..

some one can help me?

alex

 

Re:about indy Tidftp vcl(indy8. delphi5)


hmm.. no 1 at Indy team can help me?
Quote
On Mon, 17 Jun 2002 02:02:04 +0800, Alex <a...@263.net.cn> wrote:
>hi all,

>i have questions about TidFtp componnet.

>when i use it to connect to a ftp.. i do this..

>if (not ftp.connected) then ftp.connect..

>but will failed when server kick me out or server time out.

>then i change to :

><------------------------------------------

>  procedure ConnectToFtp(SiteName: string; AFtp: TIdFtp);
>  begin
>    Retry := 3;
>    FtpConnected := False;
>    while Retry > 0 do begin
>      try
>        Log(SiteName + '.Logon');
>        try
>          AFtp.CheckForDisconnect(True, False);
>          AFtp.CheckForGracefulDisconnect;
>          AFtp.Noop;
>          FtpConnected := True;
>        except
>          FtpConnected := False;
>        end;
>        if not FtpConnected then
>          AFtp.Connect;
>        Log(SiteName + '.Logoned');
>        Retry := 0;
>      except
>        Dec(Retry);
>        Log(SiteName + '.Retry');
>        Sleep(1000);
>        Self.Synchronize(Application.ProcessMessages);
>        AFtp.Disconnect;
>        if Retry = 0 then raise Exception.Create(SiteName +
>'.Login.Failed');
>      end;
>    end;
>  end;

>------------------------------------------->

>but sometimes still will error with a winsock error "xxx.. refused.."
>or other message..

>some one can help me?

>alex

Re:about indy Tidftp vcl(indy8. delphi5)


with my procedure.. indy still will raise a 10061 "connection refused"
error.. when i retry 2-4 times.. all are ok..

who can help me plz :-(

alex

Quote
On Mon, 17 Jun 2002 02:02:04 +0800, Alex <a...@263.net.cn> wrote:
>hi all,

>i have questions about TidFtp componnet.

>when i use it to connect to a ftp.. i do this..

>if (not ftp.connected) then ftp.connect..

>but will failed when server kick me out or server time out.

>then i change to :

><------------------------------------------

>  procedure ConnectToFtp(SiteName: string; AFtp: TIdFtp);
>  begin
>    Retry := 3;
>    FtpConnected := False;
>    while Retry > 0 do begin
>      try
>        Log(SiteName + '.Logon');
>        try
>          AFtp.CheckForDisconnect(True, False);
>          AFtp.CheckForGracefulDisconnect;
>          AFtp.Noop;
>          FtpConnected := True;
>        except
>          FtpConnected := False;
>        end;
>        if not FtpConnected then
>          AFtp.Connect;
>        Log(SiteName + '.Logoned');
>        Retry := 0;
>      except
>        Dec(Retry);
>        Log(SiteName + '.Retry');
>        Sleep(1000);
>        Self.Synchronize(Application.ProcessMessages);
>        AFtp.Disconnect;
>        if Retry = 0 then raise Exception.Create(SiteName +
>'.Login.Failed');
>      end;
>    end;
>  end;

>------------------------------------------->

>but sometimes still will error with a winsock error "xxx.. refused.."
>or other message..

>some one can help me?

>alex

Re:about indy Tidftp vcl(indy8. delphi5)


no1 know this?  or no1 know advance level program?

i sad.

Quote
On Mon, 17 Jun 2002 02:02:04 +0800, Alex <a...@263.net.cn> wrote:
>hi all,

>i have questions about TidFtp componnet.

>when i use it to connect to a ftp.. i do this..

>if (not ftp.connected) then ftp.connect..

>but will failed when server kick me out or server time out.

>then i change to :

><------------------------------------------

>  procedure ConnectToFtp(SiteName: string; AFtp: TIdFtp);
>  begin
>    Retry := 3;
>    FtpConnected := False;
>    while Retry > 0 do begin
>      try
>        Log(SiteName + '.Logon');
>        try
>          AFtp.CheckForDisconnect(True, False);
>          AFtp.CheckForGracefulDisconnect;
>          AFtp.Noop;
>          FtpConnected := True;
>        except
>          FtpConnected := False;
>        end;
>        if not FtpConnected then
>          AFtp.Connect;
>        Log(SiteName + '.Logoned');
>        Retry := 0;
>      except
>        Dec(Retry);
>        Log(SiteName + '.Retry');
>        Sleep(1000);
>        Self.Synchronize(Application.ProcessMessages);
>        AFtp.Disconnect;
>        if Retry = 0 then raise Exception.Create(SiteName +
>'.Login.Failed');
>      end;
>    end;
>  end;

>------------------------------------------->

>but sometimes still will error with a winsock error "xxx.. refused.."
>or other message..

>some one can help me?

>alex

Other Threads