Resume function not correctly download my file (General questions)
Hi
I've made simple application using delphi to download file using wodftpdlx resume property. Firstly, it seems works correctly, which is shown by the progress bar status (listening for OnProgress and OnProgress64 event). But after I checked size of downloaded file, it show me that it size is bigger than it should be. For Example, if my file is 8mb, and it stop on 1mb, than the total filesize is becoming 9mb. Is there any reason why my program did not work correctly.
Regards
- Rossi
Re: Resume function not correctly download my file
Hi Rossi,
Please download latest version of wodFtpDLX ActiveX component. Maybe your problem with Resume Property is something that is fixed in some of our previous version. Latest version is 2.6.0.253.
You can download latest version of wodFtldDLX here:
http://www.weonlydo.com/Samples/wodFtpDLX.exe
If you are registered user, you can download latest version of wodFtpDLX here:
http://www.weonlydo.com/index.asp?update=1
This is automated process. Make sure you use same email address that is registered with our system, one you used when you have purchased the product.
If problem persist please, send us your server type/vendor/name so we can duplicate it.
Which Protocol are you using?
Are you using blocking or non blocking mode?
Also if you are using TransferMode Property and change type of transfer, then Resume Property is unstable.
Hope I helped.
Regards,
Drazen
Re: Resume function not correctly download my file
Yes Sir, I've downloaded the latest version of WodFTPDLX. But I still found the same problem. I am using Serv-U FTP Server (www.RhinoSoft.com), FTPS Implicit protocol,and using blocking mode. If it's needed, may I post my sample program ? just for make sure there's no thing missed in my code.
Thank for advance
Re: Resume function not correctly download my file
Rossi,
I just tested with wodFtpDLX and Serv-U 6.2.0.1 and didn't have problem with resume download file if Resume Property is turned on.
I forgot to mention that you need to reimport reference in Delphi when you install new version of wodFtpDLX maybe this could cause your problem. You can check this out by calling Version Property
Here is example:
------------------------
Label1.Caption := wodFtpDLX1.Version;
------------------------
Also you can paste here your code.
Maybe problem is with Serv-U.You can try if you have some older version of Serv-U with some other FTP client.
Drazen
Re: Resume function not correctly download my file
Have re-import type library and still have the same.
Basically there're only 2 main function in my program, those are Connect2FtpServer and GetFileViaFtp. Here're the detail:
function TForm1.Connect2FtpServer: boolean;
var
isConnected: boolean;
i: integer;
begin
try
try
i:= 0;
isConnected:= false;
while (not isConnected)and(i<=10) do
begin
try
MywodFtp.Hostname:= Edit3.Text;
MywodFtp.Port:= strtoint(Edit6.Text);
MywodFtp.Protocol:= ComboBox1.ItemIndex;{use 4 for implicit}
MywodFtp.Blocking:= true;
MywodFtp.Login:= Edit4.Text;
MywodFtp.Password:= Edit5.Text;
MywodFtp.Disconnect1;
if i<>0 then
begin
Sleep(1000);
memo1.Lines.Add('RESUME CONNECT #'+inttostr(i));
end;
MywodFtp.Connect1;
isConnected:= true;
except
isConnected:= false;
end;
i:= i+1;
end;
finally
result:= isConnected;
end;
except
result:= false;
end;
end;
function TForm1.GetFileViaFtp(rfname, fname: string; var err: string;
isResume: boolean): boolean;
var
i: integer;
isSuccess: boolean;
tmpFName: string;
isDownloaded: boolean;
begin
try
if Length(rfname)>0 then
if rfname[1]<>'/' then
rfname:= '/'+ rfname;
isResume:= false;
if rfname[Length(rfname)]<>'/' then
begin
Result:= true;
i:=0;
isSuccess:= false;
while (not isSuccess)and(i<10) do
begin
try
if i=0 then
begin
MywodFtp.Resume:= false;
MywodFtp.GetFile(fname,rfname);
end else
begin
Sleep(1000);
isResume:= isResume;
MywodFtp.Resume:= true;
Memo1.Lines.Add('RESUME #'+inttostr(i+1));
MywodFtp.GetFile(fname,rfname);
end;
isSuccess:= true;
except
on e: Exception do
begin
isSuccess:= false;
err:= e.Message;
if e.Message='Cannot execute, not yet connected' then
Connect2FtpServer;
if (e.Message='Requested action not taken. File unavailable (e.g., file not found, no access)') then
isSuccess:= true
else
isSuccess:= false;
end;
end;
i:= i+1;
end;
result:= isSuccess;
end else
begin
Result:= true;
end;
except
on E: Exception do
begin
result:= false;
err:= e.Message;
end;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
err: string;
begin
if Connect2FtpServer then
begin {use true to resume mode}
if GetFileViaFtp(Edit1.Text,Edit2.Text,err,CheckBox1.Checked) then
begin
MessageDlg('Download process finished',mtConfirmation,[mbOK],0);
end else
begin
MessageDlg('Download process finished',mtError,[mbOK],0);
end;
end else
begin
MessageDlg('Can not connect to FTPServer',mtError,[mbOK],0);
end;
end;
----- finished ---
Is there something missed with that code?
Re: Resume function not correctly download my file
Sorry, please remove this row :
isResume:= false; in the GetFileViaFtp function
Re: Resume function not correctly download my file
Rossi,
Please try this simple code to isolate your problem:
-------------------------------
dlx1.Hostname := your_lhostname';
dlx1.Protocol := 4;
dlx1.Login := 'your_login';
dlx1.Password := 'your_password';
dlx1.Blocking := true;
dlx1.Resume := true;
dlx1.Connect1;
dlx1.GetFile ('c:\test.txt','/c:/something/test.txt');
-------------------------------
Sleep API isn't good since it blocks same thread where wodFtpDLX lives in.
Also if you are using Port Property, you must put it in your code after Protocol Property. That is how wodFtpDLX works.
Drazen
Re: Resume function not correctly download my file
I'm sorry Sir, I've used your simple code, everything is exactly written as you said. But I still stuck on it.
For information, I am using Serv-U ver 6.3, and the version of wodftpdlx which being used is WodFtpDlx version 2.6.1.256. I've try using smartFTP to check resume compatibility of Serv-U 6.3, and it works. Is there any Demo Example of WODFTPDlx in delphi that I can downloaded ?
regards
- rossi
Re: Resume function not correctly download my file
Hi Rossi,
Which version of Delphi are you using? I just tested with Delphi 7 and Serv-u 6.3 and it works for me.
You can find in wodFtpDLX Samples Folder under folder Delphi 7 sample that can help you.
Drazen
Re: Resume function not correctly download my file
Hello Drazen,
I found something interest after trying the wodftp sample in Delphi. Yes, I'm using delphi 7.
I try to download movie file whose size is 90mb, and put new button on form to simulate abort function(ftpdlx1.Abort). Then checked resume and blocking checkedbox, then connect and download file. In the middle of downloading process, I pressed abort button, I wish it can represents a bad connection condition. Then I quit, and run the program again. And resume download process, in the end of process (stated by progress bar status), it raises floating point division by zero . And the downloaded filesize always becoming 1-2kb bigger then it should be,and it made the movie cannot be played well.
Other things that also interesting is, when I replace OnProgress event using these code :
procedure TForm1.ftpdlx1Progress(ASender: TObject; Position,
Total: Integer);
begin
pb1.Position:= Position;
pb1.Max:= Total;
end;
Then, it will not raise that exception anymore, but, in the end of process, downloaded file size becoming = originil_file_size + stopped_file_size. I mean, if I press abort button after the program download 5mb, in the end of process, it will be = 95mb
Re: Resume function not correctly download my file
Hi Rossi,
I just tried the same thing as you described, but i didnt manage to duplicate your problem.I tried checking Blocking & Resume Checkboxes, then clicking on Abort, and the next time i connected, the resume process finished, and the file was transferred correctly.
The video file was playable after that.
Can you tell me your server type/vendor? Maybe there is a step you missed mentioning, so i can't duplicate this?
Regards,
Damir
Re: Resume function not correctly download my file
I'm sorry Sir, I forgot to mention that I use FTPS Implicit, protocol 4. I found that if I use ftp regular, it's all work fine, but not with FTPS Implicit.
For information, I use Serv-U FTP Server Ver 6.3.0.0, Delphi 7, WODFtpDlx.dll ver 2.6.1.256.
regards
-rossi
Re: Resume function not correctly download my file
Hi Rossi,
Sorry, missed that in last posts...
Please give me some time to test this, i'll get back to you as soon as possible.
Regards,
Damir
Re: Resume function not correctly download my file
Hi Rossi,
We need to duplicate your problem somehow.
So you have Serv-U install locally or you are connecting to some Serv-U server?
If you are connecting to some Serv-U server, is there any chance that we can connect to that server and duplicate your problem. You can send private information to techsupport@weonlydo.com, is this possible?
Or if you are using Serv-U locally, can you somehow put it online? So we can test it and maybe duplicate your problem.
Also please send private information to techsupport@weonlydo.com.
You can also put in your code before Connect Method DebugFile Property (hidden property) and send that file to us (techsupport e-mail).
Here is example:
----------------
dlx1.DebugFile := 'c:\debug.txt';
----------------
Are you using default Serv-U preference or you change something?
Resume Property can cause trouble when used in ASCII mode. Are TransferMode changed from Binary to ASCII. Can you investigate that?
Regards,
Drazen
Re: Resume function not correctly download my file
Hello Sir,
I've just send confirmation email on techsupport@weonlydo.com.
Hope it can help to investigate unknown behaviour . [:smile:]
regards
-rossi
Re: Resume function not correctly download my file
Yes Sir,
I use default Serv-U preference, except for Lock users in home directory option, I make it enable.
I also did not change TransferMode property. I just use demo sample program from WODFtpDlx installation.
regards
Re: Resume function not correctly download my file
Rossi,
I was able to duplicate this, it was a bug.
This is now fixed.
Regards,
Drazen