Page 1 of 1

Problem with HBTIP

Posted: Thu Aug 14, 2014 1:36 pm
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.

Re: Problem with HBTIP

Posted: Thu Aug 14, 2014 7:10 pm
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?

Re: Problem with HBTIP

Posted: Thu Aug 14, 2014 8:52 pm
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.

Re: Problem with HBTIP

Posted: Thu Aug 14, 2014 9:03 pm
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 301 times

Re: Problem with HBTIP

Posted: Fri Aug 15, 2014 12:19 am
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.

Re: Problem with HBTIP

Posted: Fri Aug 15, 2014 12:28 am
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 ..