Problem with HBTIP

Issues and Discussions related to Harbour

Moderator: Rathinagiri

Post Reply
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Problem with HBTIP

Post by Roberto Lopez »

Hi All,

I've detected a problem with HBTIP FTP download.

If the connection fails during file downloading, oFtp:DownloadFile returns .t..

You can test simply unplugging the network cable during download.

Code: Select all

FUNCTION MAIN

	cServer := 'server:port' 
	cUser     := "user"     
	cPassword := "pass"  

	cUrl      := "ftp://" + cUser + ":" + cPassword + "@" + cServer

	oUrl              := tUrl():New( cUrl )
	oFTP              := tIPClientFtp():New( oUrl, .F. )
	oFTP:nConnTimeout := 20000
	oFTP:bUsePasv     := .T.

	IF At( "@", cUser ) > 0
		oFTP:oUrl:cServer   := cServer
		oFTP:oUrl:cUserID   := cUser
		oFTP:oUrl:cPassword := cPassword
	ENDIF

	IF oFTP:Open( cUrl )

		? 'downloading...'
		
		// HERE!!!!
		// If connection fails during downloading, no error 
		// occurs and the 'OK' alert is shown.
		// It can be tested, simply unplugging the LAN
		// cable while file is downloading.
	
		IF !oFtp:DownloadFile( 'test.dat' )
			oFTP:Close()
			ALERT('Error!' )
			RETURN NIL
		ENDIF

		oFTP:Close()

		// and HERE!

		ALERT('Ok')
	
	ELSE

		ALERT('Error!')
		
	ENDIF

Return Nil
Any workaround for this?

TIA.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: Problem with HBTIP

Post by andyglezl »

There were some changes in the following?
----------------------------------------------------------------------------------------

#require "hbtip"
#include "tip.ch"
#include "hbxml.ch"
What I discuss in the previous link viewtopic.php?f=5&t=2983&p=35727#p35727
could be part of the same?
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Problem with HBTIP

Post by Roberto Lopez »

andyglezl wrote:
There were some changes in the following?
----------------------------------------------------------------------------------------

#require "hbtip"
#include "tip.ch"
#include "hbxml.ch"
What I discuss in the previous link viewtopic.php?f=5&t=2983&p=35727#p35727
could be part of the same?
This example is Harbour only and is based on one of the HBTIP samples, so, there is not related to a specific HMG release.

I'll test the #includes you signal, but, since the example builds ok, should be not differences. I'll keep you posted.

Thanks.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
danielmaximiliano
Posts: 2612
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: Problem with HBTIP

Post by danielmaximiliano »

Hola Roberto :

Hice un ejemplo para probar el error que te aparece al sacar la ficha RJ de red y que la funcion oFtp:DownloadFile( cFile )
devuelve .T.

al probar con mi netbook desconectando la conexion Wifi por un tiempo largo la aplicacion retoma la descarga y no presenta inconveniente pero a veces menos de 30 seg y da error con la repuesta del servidor oFTP:cReply
pero la funcion devuelve .T.

te sugeriria que uses la repuesta del servidor como metodo confiable para saber si el fichero fue descargado correctamente.

el mismo devuelve "226" para correcto y otros valores para indicar algun tipo de inconveniente o Nulo.

http://en.wikipedia.org/wiki/List_of_FT ... turn_codes


Sample Test
FtpTest2.rar
Clean sample
(11.73 KiB) Downloaded 286 times
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Problem with HBTIP

Post by Roberto Lopez »

danielmaximiliano wrote:al probar con mi netbook desconectando la conexion Wifi por un tiempo largo la aplicacion retoma la descarga y no presenta inconveniente pero a veces menos de 30 seg y da error con la repuesta del servidor oFTP:cReply
pero la funcion devuelve .T.
Muchas Gracias Daniel.

Encontré el problema, cuando una de mis aplicaciones, que se actualiza automátocamente via FTP, fallaba (quedaba un ejecutable trunco, sin mediar mensaje de error).

Esto pasaba cuando la actualización se realizaba en condiciones complicadas (usualmente redes wifi con mucho tráfico) así que resultó obvio, que ante una falla en la descarga, no se registraba el error.

Nuevamente, Muchas Gracias.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
danielmaximiliano
Posts: 2612
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: Problem with HBTIP

Post by danielmaximiliano »

Me alegra que hayas encontrado la solucion a tú problema..

mirando HBTip encontre que el LOG crece acorde al tamaño del archivo a descargar !!!! al final es un poco mayor al archico descargado.
ocupa tiempo y lugar en el disco.. por suerte solo lo utilizo para ver los resultados mientras voy viendo en que fallo..

nos vemos Roberto ..
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
Post Reply