Page 10 of 12
Re: NC Clone
Posted: Thu Sep 10, 2020 1:02 am
by AUGE_OHR
hi,
have fix Modi Stru Problem and add Port to HbFTP
- HbFTP_Port.jpg (35.57 KiB) Viewed 3071 times
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
Re: NC Clone
Posted: Thu Sep 10, 2020 2:41 am
by danielmaximiliano
Hi jimmy :
remembering the use of HBTIP since I did Email examples I had checked the tUrl class that returns an oUrl object, this class receives a cUrl text containing the following fields
- cUrl.png (7.92 KiB) Viewed 3065 times
this kind of returns to itself
Code: Select all
METHOD New( cUrl ) CLASS TUrl
::SetAddress( cUrl )
RETURN Self
This object can return incorrect as indicated here, it can behave well with domains such as
example.org but wrongly before IP addresses like 192.168.1.39
study tUrl class
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 )
It is a mistake to create an object and then send it to build another object without the proper consistency.
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.
I suggest you try the following code to eliminate that IP address or domain error
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.
Re: NC Clone
Posted: Thu Sep 10, 2020 4:57 am
by AUGE_OHR
hi,
danielmaximiliano wrote: ↑Thu Sep 10, 2020 2:41 am
I suggest you try the following code to eliminate that IP address or domain error
Code: 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.
it is a good Idea using BEGIN SEQUENCE
i have try that Code but end up in RECOVER
so i reduce it to
Code: Select all
IF !EMPTY( nPort )
oURL:nPort := nPort
ENDIF
and now i got Connect again
hm ... perhaps i need to fill default Value to 21 as you say.
Re: NC Clone
Posted: Thu Sep 17, 2020 11:26 pm
by AUGE_OHR
latest Version v1.27
32 Bit
64 Bit
fixed :
fixed Thumbs ImageRelease "SlideTime"
fixed SumatraPDF Filename with Space
new :
HbFTP : default Port := 21
Re: NC Clone
Posted: Tue Sep 22, 2020 1:21 am
by danielmaximiliano
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.
From already thank you very much
Re: NC Clone
Posted: Tue Sep 22, 2020 1:45 am
by AUGE_OHR
hi,
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.
64 Bit DLL / Lib of FreeImage is found in this Thread.
http://www.hmgforum.com/viewtopic.php?f ... 7&start=23
Code for Libxlsxwriter is still include but as i´m not able to generate 64 Bit DLL / LIB it is not active
ADO must be installed as ActiveX but have no LIB to include
---
what do you want to modify
SFTP ...
Re: NC Clone
Posted: Tue Sep 22, 2020 8:07 pm
by danielmaximiliano
Hi Jimmy:
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
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
- 2020-09-22 17_02_55-FTP Client v0.1.0 modify for HMG.png (32.46 KiB) Viewed 2895 times
Re: NC Clone
Posted: Tue Sep 22, 2020 8:36 pm
by AUGE_OHR
hi,
danielmaximiliano 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
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
Re: NC Clone
Posted: Wed Sep 23, 2020 2:20 pm
by danielmaximiliano
AUGE_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
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 8556
-----------------------------------------------------------------------------------------------------------------------------------------------------------
HBtip by default assumes port 21 for FTP services that you can check in C:\Harbour\contrib\hbtip\ftpcli.prg
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
If you look inside the example you will see C:\Harbour\contrib\hbtip\tests\*.*
that the port is never added, in case the port is different, it should be able to change in the case that I requested for NC clone.
I am going to review this inconvenience that is within HBTIP to set up an IP address correctly in case of being internal class C networks such as 192.168.1.1
Re: NC Clone
Posted: Fri Sep 25, 2020 5:40 am
by AUGE_OHR
hi,
it seem there is a big BUG in HBFM since v1.17
after delete a File HBFM does not work correct with F3/F4 and show "black" Window or "no Image" etc.