FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour FTP problem using tIpClientFTP
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
FTP problem using tIpClientFTP
Posted: Wed Jan 14, 2015 11:29 AM

Hi, I'm using FWH Dec 2014 with the associated xHarbour version (1.2.3 build 20141106).
I always used tIpClientFtp to transfer files but now with a new server I'm unable to do it.
Please note that using a standard ftp client (example CuteFtp) all runs well and also this self contained sample runs with another server (but with a domain name).
I also checked the tIpClientFtp log sequence but I didn't understand the reason of the problem.
Do you think there are some problem using a direct ip instead of a domain name with tIpClientFtp ?

Anyway this is a small self contained sample that show the problem. Any help really appreciated. Thank you in advance.

include "FiveWin.ch"

//----------------------------------------------------------------------------//

function Main()
local nTimeout,lTrace,cFsrv,cFusr,cFpsw,cFile,cUrl,oFtp

nTimeout=6000

lTrace:=.t.
cFsrv:="88.208.208.197"
cFusr:="test"
cFpsw:="password!"
cFile:="testftp.prg"

cFusr:=charrepl("@",@cFusr,"+")
cUrl:="ftp://"+cFusr+":"+cFpsw+"@"+cFsrv

oFtp:=tIPClientFtp():New(cUrl,lTrace)
oFtp:nConnTimeout:=nTimeOut

if .not. oFtp:open()
msginfo("Ftp error "+oFtp:LastErrorMessage())
quit
endif

if .not. oFtp:UploadFile(cFile)
msginfo("ftp error [upload] "+oFtp:LastErrorMessage())
quit
endif
oFtp:Close()
return nil

//----------------------------------------------------------------------------//

Best Regards,



Marco Turco

SOFTWARE XP LLP
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: FTP problem using tIpClientFTP
Posted: Wed Jan 14, 2015 01:37 PM
Marco,

I just run your sample and got no error messages. This is ftp.log:

Code (fw): Select all Collapse
20150114-14:35:25  :INETCONNECT( 88.208.208.197, 21 )
>> 231F2C0 <<

20150114-14:35:25  :INETERRORCODE( 231F2C0 )
>>          0 <<

20150114-14:35:25  :INETRECVLINE( 231F2C0, , 128 )
>> 220 ProFTPD 1.3.4a Server (ProFTPD) [88.208.208.197] <<

20150114-14:35:25  :INETERRORCODE( 231F2C0 )
>>          0 <<

20150114-14:35:25  :INETSENDALL( 231F2C0, 11, USER test )
>>         11 <<

20150114-14:35:26  :INETRECVLINE( 231F2C0, , 128 )
>> 331 Password required for test <<

20150114-14:35:26  :INETERRORCODE( 231F2C0 )
>>          0 <<

20150114-14:35:26  :INETSENDALL( 231F2C0, 16, PASS password! )
>>         16 <<

20150114-14:35:26  :INETRECVLINE( 231F2C0, , 128 )
>> 230 User test logged in <<

20150114-14:35:26  :INETERRORCODE( 231F2C0 )
>>          0 <<

20150114-14:35:26  :INETSENDALL( 231F2C0, 8, TYPE I )
>>          8 <<

20150114-14:35:26  :INETRECVLINE( 231F2C0, , 128 )
>> 200 Type set to I <<

20150114-14:35:26  :INETERRORCODE( 231F2C0 )
>>          0 <<

20150114-14:35:26  :INETSENDALL( 231F2C0, 7, CWD / )
>>          7 <<

20150114-14:35:26  :INETRECVLINE( 231F2C0, , 128 )
>> 250 CWD command successful <<

20150114-14:35:26  :INETERRORCODE( 231F2C0 )
>>          0 <<

20150114-14:35:26  :INETSENDALL( 231F2C0, 6, PASV )
>>          6 <<

20150114-14:35:26  :INETRECVLINE( 231F2C0, , 128 )
>> 227 Entering Passive Mode (88,208,208,197,175,208). <<

20150114-14:35:26  :INETERRORCODE( 231F2C0 )
>>          0 <<

20150114-14:35:26  :INETSENDALL( 231F2C0, 18, STOR testftp.prg )
>>         18 <<

20150114-14:35:47  :INETERRORCODE( 231F318 )
>>          2 <<

20150114-14:35:47  :INETSENDALL( 231F2C0, 660, #include "FiveWin.ch"//----------------------------------------------------------------------------//function Main()local nTimeout,lTrace,cFsrv,cFusr,cFpsw,cFile,cUrl,oFtpnTimeout=6000lTrace:=.t.cFsrv:="88.208.208.197"cFusr:="test"cFpsw:="password!"cFile:="testftp.prg"cFusr:=charrepl("@",@cFusr,"+")cUrl:="ftp://"+cFusr+":"+cFpsw+"@"+cFsrvoFtp:=tIPClientFtp():New(cUrl,lTrace)oFtp:nConnTimeout:=nTimeOutif .not. oFtp:open() msginfo("Ftp error "+oFtp:LastErrorMessage()) quitendifif .not. oFtp:UploadFile(cFile) msginfo("ftp error [upload] "+oFtp:LastErrorMessage()) quitendifoFtp:Close()return nil )
>>        660 <<

20150114-14:35:47  :INETRECVLINE( 231F2C0, , 128 )
>> NIL <<


EMG
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Re: FTP problem using tIpClientFTP
Posted: Wed Jan 14, 2015 06:24 PM

Hi Enrico.
there is a NIL at the end of the log
and if you check with an ftp client that ftp directory you will find it empty, the file has not been trasferred.

Best Regards,



Marco Turco

SOFTWARE XP LLP
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Re: FTP problem using tIpClientFTP
Posted: Thu Jan 15, 2015 06:25 PM

Solved,
the CentOS server with ProFtpD require the PORT MODE ftp access instead of PASSIVE MODE as default and tIpClientFtp seems doesn't support PORT MODE.
I changed the CentoOS config using modprobe ip_conntrack_ftp to activate the ProFtpD passive mode and the problem is now solved.

I think it could be great if the tIpClientFtp could support the FTP PORT MODE that is more safety than PASSIVE MODE.

Best Regards,



Marco Turco

SOFTWARE XP LLP
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: FTP problem using tIpClientFTP
Posted: Thu Jan 15, 2015 06:58 PM

Marco,

do you mean "ACTIVE MODE"?

EMG

Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Re: FTP problem using tIpClientFTP
Posted: Thu Jan 15, 2015 09:04 PM
No, I mean PORT MODE, see image from CuteFtp FTP configuration.
Best Regards,



Marco Turco

SOFTWARE XP LLP
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: FTP problem using tIpClientFTP
Posted: Thu Jan 15, 2015 09:16 PM

Marco,

I think PORT MODE is not supported by Windows API so we would need of an external DLL... :-(

EMG

Continue the discussion