Hallo,
hat jemand eine Idee warum folgender Code in der Schleife nach einem Durchlauf hängen bleibt?
Delphi-Quellcode:
for i := flist.Count-1 downto 0 do
begin
sFilename := extractfilepath(paramstr(0)) + flist[i].NodeValue;
sFile := TFileStream.Create(sFilename, fmCreate);
try
fparams.Text := 'RPC=download';
fparams.Add('file=' + flist[i].NodeValue);
Queue ( procedure begin Form2.log('Post'); end);
fhttp.Post(TIdURI.URLEncode(fURL), fparams, sFile);
finally
fhttp.Disconnect;
sFile.Free;
Queue ( procedure begin Form2.log('SetFileDate'); end);
SetFileDate(sFilename, UnixToDateTime(flist[i].Attributes['timestamp']));
// --> hier hört er nach einem Durchlauf auf <-- das Filedate wird noch einwanfrei gesetzt....
end;
end;
Ich vermute es gibt ein Problem mit dem Filestream und dem Beschreiben dessen durch
indy (idHttp). Es gibt keine
Exception. Das Programm hängt sich einfach nur auf.
Mit einem
Handle hatte ich leider auch keinen Erfolg:
Delphi-Quellcode:
for i := flist.Count-1 downto 0 do
begin
if (pos(flist[i].NodeValue + #255 + flist[i].Attributes['timestamp'], currentList.Text) > 0) then continue; //Datumsvergleich
Queue ( procedure begin Form2.log('entry ' + inttostr(i) + ': ' + flist[i].NodeValue + #255 + flist[i].Attributes['timestamp']); end);
//Download
sFilename := extractfilepath(paramstr(0)) + flist[i].NodeValue;
//sFile := TFileStream.Create(sFilename, fmCreate);
Handle1 := CreateFile(PChar(sFilename), GENERIC_WRITE, FILE_SHARE_WRITE, nil, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
fileStream := THandleStream.Create(Handle1);
try
fparams.Text := 'RPC=download';
fparams.Add('file=' + flist[i].NodeValue);
Queue ( procedure begin Form2.log('Post'); end);
fhttp.Post(TIdURI.URLEncode(fURL), fparams, fileStream); //sFile
Queue ( procedure begin Form2.log('Nächster'); end);
finally
fhttp.Disconnect;
//sFile.Free;
fileStream.Free;
CloseHandle(Handle1);
//Queue ( procedure begin Form2.log('SetFileDate'); end);
SetFileDate(sFilename, UnixToDateTime(flist[i].Attributes['timestamp']));
end;
Was mache ich falsch?
LG