have fix Modi Stru Problem and add Port to HbFTP latest Version v1.26
32 Bit 64 Bit
have also update Source on Github
known Problem : when start HBFM64.EXE 1st time it take much time ...

does not happen with 32 BIT App
Moderator: Rathinagiri
Code: Select all
METHOD New( cUrl ) CLASS TUrl
::SetAddress( cUrl )
RETURN Self
Code: Select all
METHOD SetAddress( cUrl ) CLASS TUrl
LOCAL aMatch, cServer, cPath
IF ! HB_ISSTRING( cUrl )
RETURN .F.
ENDIF
::cAddress := cUrl
::cProto := ""
::cUserid := ""
::cPassword := ""
::cServer := ""
::cPath := ""
::cQuery := ""
::cFile := ""
::nPort := -1
IF cUrl == ""
RETURN .T.
ENDIF
// Top-level URL parsing. May fail. <----- HERE
IF Empty( aMatch := hb_regex( ::cREuri, cUrl ) )
RETURN .F.
ENDIF
::cProto := Lower( aMatch[ 2 ] )
cServer := aMatch[ 3 ]
cPath := aMatch[ 4 ]
::cQuery := aMatch[ 5 ]
// server parsing (never fails)
aMatch := hb_regex( ::cREServ, cServer )
::cUserId := aMatch[ 2 ]
::cPassword := aMatch[ 3 ]
::cServer := aMatch[ 4 ]
::nPort := Val( aMatch[ 5 ] )
IF ::nPort < 1
::nPort := -1
ENDIF
// Parse path and file (never fails)
aMatch := hb_regex( ::cREFile, cPath )
::cPath := aMatch[ 2 ]
::cFile := aMatch[ 3 ]
RETURN .T.
METHOD BuildAddress() CLASS TUrl
LOCAL cRet := ""
IF ::cProto != NIL
::cProto := Lower( ::cProto )
ENDIF
IF ! Empty( ::cProto ) .AND. ! ::cServer == ""
cRet := ::cProto + "://"
ENDIF
IF ! ::cUserid == ""
cRet += ::cUserid
IF ! ::cPassword == ""
cRet += ":" + ::cPassword
ENDIF
cRet += "@"
ENDIF
IF ! ::cServer == ""
cRet += ::cServer
IF ::nPort > 0
cRet += ":" + hb_ntos( ::nPort )
ENDIF
ENDIF
IF ::cPath == "" .OR. ! Right( ::cPath, 1 ) == "/"
::cPath += "/"
ENDIF
cRet += ::cPath + ::cFile
IF ! ::cQuery == ""
cRet += "?" + ::cQuery
ENDIF
RETURN iif( cRet == "", NIL, ::cAddress := cRet )
Code: Select all
oUrl := tURL() :New( cUrl )
IF EMPTY( oUrl )
RETURN nil
ENDIF
oClient := TIpClientFtp() :new( oUrl, Sites->Log ) // PARAM .T. TO LOG
IF EMPTY( oClient )
RETURN nil
ENDIF
oClient:nConnTimeout := 2000
oClient:bUsePasv := .T.
Code: Select all
STATIC FUNCTION ftpConnect()
LOCAL bError := ERRORBLOCK( { | oErr | BREAK( oErr ) } )
LOCAL lConnect := .F.
LOCAL cUser := sites->user
LOCAL cPassWord := desencri( sites->password )
LOCAL cServer := sites->address
LOCAL cUrl
cUrl := "ftp://" + ALLTRIM( cUser ) + ":" + ALLTRIM( cPassWord ) + "@" + ALLTRIM( cServer )
oUrl := tURL() :New( cUrl )
IF EMPTY( oUrl )
RETURN nil
ENDIF
oUrl:cProto := "ftp://"
oUrl:cServer := cServer
oUrl:cUserId := sites->user
oUrl:cPassword := adesencri( sites->password )
oUrl:nPort := sites->port // Numeric
BEGIN SEQUENCE
oClient := TIpClientFtp() :new( oUrl, Sites->Log ) // PARAM .T. TO LOG
RECOVER
MsgBox('can not Open() the connection, try again ' , 'Attention message' )
Return nil
END
oClient:nConnTimeout := 2000
oClient:bUsePasv := .T.
it is a good Idea using BEGIN SEQUENCEdanielmaximiliano wrote: ↑Thu Sep 10, 2020 2:41 am I suggest you try the following code to eliminate that IP address or domain errorCode: Select all
cUrl := "ftp://" + ALLTRIM( cUser ) + ":" + ALLTRIM( cPassWord ) + "@" + ALLTRIM( cServer ) oUrl := tURL() :New( cUrl ) IF EMPTY( oUrl ) RETURN nil ENDIF oUrl:cProto := "ftp://" oUrl:cServer := cServer oUrl:cUserId := sites->user oUrl:cPassword := adesencri( sites->password ) oUrl:nPort := sites->port // Numeric BEGIN SEQUENCE oClient := TIpClientFtp() :new( oUrl, Sites->Log ) // PARAM .T. TO LOG RECOVER MsgBox('can not Open() the connection, try again ' , 'Attention message' ) Return nil END oClient:nConnTimeout := 2000 oClient:bUsePasv := .T.
Code: Select all
IF !EMPTY( nPort )
oURL:nPort := nPort
ENDIF
Hi Jimmy: download from the NC clone version, I could recover the \RES folder and compile, I would need the 32 and 64 bit libs that it uses and in that way to be able to correctly execute NC clone, in that way to be able to modify the FTP option of the Same.AUGE_OHR wrote: ↑Wed Aug 26, 2020 8:54 pm
! Note : Source Code is avaiable under https://github.com/AugeOhr/HBFM
(no Image include in Source)
64 Bit DLL / Lib of FreeImage is found in this Thread.danielmaximiliano wrote: ↑Tue Sep 22, 2020 1:21 am Hi Jimmy: download from the NC clone version, I could recover the \RES folder and compile, I would need the 32 and 64 bit libs that it uses and in that way to be able to correctly execute NC clone, in that way to be able to modify the FTP option of the Same.
Code: Select all
STATIC FUNCTION ftpConnect()
LOCAL bError
LOCAL lConnect := .F.
LOCAL cUser := sites->user
LOCAL cPassWord := desencri( sites->password )
LOCAL cServer := sites->address
LOCAL nPort := sites->Port
LOCAL cUrl, oError
cUrl := "ftp://" + ALLTRIM( cUser ) + ":" + ALLTRIM( cPassWord ) + "@" + ALLTRIM( cServer ) + STR ( nPort )
oUrl := tURL() :New( cUrl )
IF EMPTY( oUrl )
RETURN nil
else
msgbox( oUrl:cAddress,"Entro" )
ENDIF
i have add Port in v1.26danielmaximiliano wrote: ↑Tue Sep 22, 2020 8:07 pm As we see after general the Url when trying to connect the application remains frozen for a while until it gives an error since the URL is wrong .. that occurs when using IP addresses type B or C
Hi Jimmy, the port addition in FTP applications is to place the service on another port than the default one. as being Android that its FTP service is port 21; in this case, any other app cannot use port 21 as it is busy. that's why File Manager uses another one manually, in my case the 8556AUGE_OHR wrote: ↑Tue Sep 22, 2020 8:36 pm i have add Port in v1.26
please get latest Source from GitHub and look into HBFTP.PRG if it work for you
https://github.com/AugeOhr/HBFM
i just have test it with Port 21
Code: Select all
METHOD New( oUrl, xTrace, oCredentials ) CLASS TIPClientFTP
::super:new( oUrl, iif( hb_defaultValue( xTrace, .F. ), "ftp", xTrace ), oCredentials )
::nDefaultPort := 21
::nConnTimeout := 3000
::nAccessMode := TIP_RW // a read-write protocol
::nDefaultSndBuffSize := ::nDefaultRcvBuffSize := 65536
// precompilation of regex for better prestations
::RegBytes := hb_regexComp( "\(([0-9]+)[ )a-zA-Z]" )
::RegPasv := hb_regexComp( "([0-9]*) *, *([0-9]*) *, *([0-9]*) *, *([0-9]*) *, *([0-9]*) *, *([0-9]*)" )
RETURN Self