procedure TDownThread.Execute;
var IdFtp1:TIDFTP;
begin
IdFtp1:=TIDFTP.Create(nil);
IdFtp1.Host:=FHost;
IdFtp1.Username:=FUserName;
IdFtp1.Password:=FPassword;
IdFtp1.Port:=FPort;
try
IdFtp1.Connect(True,5000);
Synchronize(ConnectionSeceess);
FtpFlag:=True;
except
Synchronize(ConnectionFail);
FtpFlag:=False;
end;
if FtpFlag then
begin
try
IdFtp1.Get(FRemoteStr,FLocalStr,True);
ThreadCount:=ThreadCount-1;
Synchronize(DownSeceess);
except
Synchronize(DownFail);
end;
IdFtp1.Abort;
end;
IdFtp1.Free;
end;用FTP多线程下载大约下载了150个文件后就提示Connection time out
排除文件的问题,试过其它目录的文件还是在相同的位置提示Connection time out
哪位达人帮忙看看
procedure TSysFrm.Timer1Timer(Sender: TObject);
begin
if not idftp1.Connected then
idftp1.Noop;
end;timer的Interval值为 3000
我的线程中每次建立的时候都会去连接服务器,应该不可能出现一段时间内不操作就会自动断掉连接
procedure TDownThread.Execute;
var IdFtp1:TIDFTP;
begin
IdFtp1:=TIDFTP.Create(nil);
IdFtp1.Host:=FHost;
IdFtp1.Username:=FUserName;
IdFtp1.Password:=FPassword;
IdFtp1.Port:=FPort;
try
IdFtp1.Connect(True,5000);//我调试看是在这个地方出错了,但是
//为什么前面的150个都可以连接,而后面却Connection time out
Synchronize(ConnectionSeceess);
FtpFlag:=True;
except
Synchronize(ConnectionFail);
FtpFlag:=False;
end;
if FtpFlag then
begin
try
IdFtp1.Get(FRemoteStr,FLocalStr,True);
ThreadCount:=ThreadCount-1;
Synchronize(DownSeceess);
except
Synchronize(DownFail);
end;
IdFtp1.Abort;
end;
IdFtp1.Free;
end;
但还是下了一定数量的文件后就出现connection time out的错
我把超时时间设置的很长就会出现假死现象