I notice that when I use NMFTP I can receive notification of a successful upload and download ONCE in a session. If I FTP upload I recieve successful notification, if I immediatley do it again I get not notification. Is there a way to reset the process short of opening another session?
Here is the code I use:
var
ftp2: TNMFTP;
begin
ListBox1.AddItem('ftp2 Created',nil);
ftp2:= TNMFTP.Create(Self);
ftp2.OnFailure:= ftp2Failure; //specify error routine
ListBox1.AddItem('ftp2 Prpoerties Set',nil);
ftp2.FirewallType:= FTUser;
ftp2.FWAuthenticate:= false;
ftp2.Host:= '10.0.1.102';
ftp2.ParseList:= False;
ftp2.Passive:= False;
ftp2.Password:= 'admin';
ftp2.Port:= 21;
ftp2.UserID:= 'administrator';
ftp2.Connect;
if ftp2.Connected then
begin
ftp2.Mode(MODE_BYTE);
ListBox1.AddItem('ftp2 Connected',nil);
iProc:= 1; //upload
iUpCnt:= 300;
sUpLoadTitle:= 'TestUpLoadFile' + IntToStr(iUpCnt);
//First Upload
ftp2.upload('testfile',sUpLoadTitle);
ListBox1.AddItem('ftp2 UpLoaded',nil);
//Second Upload
ftp2.upload('testuploadfile1','script\rodney');
//dont get confirmation after 1st transfer
iProc:= 2; //download
iUpCnt:= 301;
sDownLoadTitle:= 'TestUpLoadFile' + IntToStr(iUpCnt);
ftp2.Download('script\rodney','test\testuploadfile100');
//First DownLoad
ftp2.Download(sUpLoadTitle + 'xx',sDownLoadTitle);
ListBox1.AddItem('ftp2 DownLoaded',nil);
//2nd DownLoad, second ftp goes, dont see the listbox
// msg for the second download
ftp2.Download(sUpLoadTitle + 'xx',sDownLoadTitle);
ListBox1.AddItem('ftp2 DownLoaded',nil);
end;
end;
procedure TForm1.ftp2Failure(var Handled: Boolean; Trans_Type: TCmdType);
begin
case Trans_Type of
cmdDownload: begin
ListBox1.AddItem('DownLoad Failed',nil);
Handled:= true;
end;
cmdUpload: begin
if iProc = 1 then
ListBox1.AddItem('UpLoad Failed',nil)
else
ListBox1.AddItem('DownLoad Failed',nil);
Handled:= true;
end;
end; //end case
end;
Here is the code I use:
var
ftp2: TNMFTP;
begin
ListBox1.AddItem('ftp2 Created',nil);
ftp2:= TNMFTP.Create(Self);
ftp2.OnFailure:= ftp2Failure; //specify error routine
ListBox1.AddItem('ftp2 Prpoerties Set',nil);
ftp2.FirewallType:= FTUser;
ftp2.FWAuthenticate:= false;
ftp2.Host:= '10.0.1.102';
ftp2.ParseList:= False;
ftp2.Passive:= False;
ftp2.Password:= 'admin';
ftp2.Port:= 21;
ftp2.UserID:= 'administrator';
ftp2.Connect;
if ftp2.Connected then
begin
ftp2.Mode(MODE_BYTE);
ListBox1.AddItem('ftp2 Connected',nil);
iProc:= 1; //upload
iUpCnt:= 300;
sUpLoadTitle:= 'TestUpLoadFile' + IntToStr(iUpCnt);
//First Upload
ftp2.upload('testfile',sUpLoadTitle);
ListBox1.AddItem('ftp2 UpLoaded',nil);
//Second Upload
ftp2.upload('testuploadfile1','script\rodney');
//dont get confirmation after 1st transfer
iProc:= 2; //download
iUpCnt:= 301;
sDownLoadTitle:= 'TestUpLoadFile' + IntToStr(iUpCnt);
ftp2.Download('script\rodney','test\testuploadfile100');
//First DownLoad
ftp2.Download(sUpLoadTitle + 'xx',sDownLoadTitle);
ListBox1.AddItem('ftp2 DownLoaded',nil);
//2nd DownLoad, second ftp goes, dont see the listbox
// msg for the second download
ftp2.Download(sUpLoadTitle + 'xx',sDownLoadTitle);
ListBox1.AddItem('ftp2 DownLoaded',nil);
end;
end;
procedure TForm1.ftp2Failure(var Handled: Boolean; Trans_Type: TCmdType);
begin
case Trans_Type of
cmdDownload: begin
ListBox1.AddItem('DownLoad Failed',nil);
Handled:= true;
end;
cmdUpload: begin
if iProc = 1 then
ListBox1.AddItem('UpLoad Failed',nil)
else
ListBox1.AddItem('DownLoad Failed',nil);
Handled:= true;
end;
end; //end case
end;