Connect() function of SmartFTP did not return a value to Navision-Attain

Hello,

We use SmartFTP library STA class in the development environment of Navision Attain (ERP) with ProFTPd server. When a FTP error occurs during login, the process using smart FTP is locked. It seems that the Connect() function of SmartFTP didn't return a value to our application in this case. This error occurs at every login error.

The SmartFTP trace :
[20060328 13:52:07] SmartFTP FTP Library v1.5.6.0
[20060328 13:52:07] Resolving host name "FTPservername"
[20060328 13:52:07] Connecting to 62.72.105.222 Port: 21
[20060328 13:52:07] Connected to FTPservername.
[20060328 13:52:07] Server closed connection

We have used the connection procedure in a loop with a dialog to reproduce and understand more easily the problem. The process only connects and disconnects from the FTP server.

Global function :

gdialog.OPEN();

UpdateDialog(1,BTC014);

IF (gf_LoadFTPSetup) THEN

BEGIN

  WHILE i<1000 DO

  BEGIN

	gboo_RetValue:=TRUE;

	CLEAR(FTPC);

	IF gf_Connect THEN

	BEGIN

	END

	ELSE gboo_RetValue:=FALSE;

	i:=i+1;

	SLEEP(100);

	IF NOT(gboo_RetValue) THEN

	  lf_SaveFTPTrace()

	ELSE

	BEGIN

	  IF NOT(lf_DeleteFile(gcu_FolderMgt.gf_RetLocWork(),gtex50_FTPTraceFileName)) THEN

		lcu_EventLog.gf_InsertEventCode(2,4,0,'FTP','E-28-020','','','','','','','','','','',FALSE);

	END

  END

END;

CloseDialog;



gf_Connect() retboo : Boolean

IF NOT(SmartFTPKey()) THEN

BEGIN

  lcu_EventLog.gf_InsertEventCode(3,3,0,'FTP','E-28-043','','','','','','','','','','',FALSE);

  EXIT(FALSE);

END;

UpdateDialog(1,BTC006);

CREATE(FTPC);

FTPC.Host:=grec_NWDSetup."FTP Server";

FTPC.Username:=grec_NWDSetup."FTP Login";

FTPC.Password:=grec_NWDSetup."FTP Password";

FTPC.Protocol:=0;//normal (not SSL)

FTPC.Passive:=grec_NWDSetup."FTP Passive Mode";

FTPC.DataTransferType:=2; //binary

FTPC.HidePassword(TRUE);

FTPC.LogFile:= gcu_Conv.MakeFilePath(gcu_FolderMgt.gf_RetLocWork(),gtex50_FTPTraceFileName);

IF FTPC.Connect()<>0 THEN

BEGIN

  lcu_EventLog.gf_InsertEventCode(3,3,0,'FTP','E-28-005','','','','','',FORMAT(FTPC.LastError()),'','','','',FALSE);

  EXIT(FALSE)

END;

IF NOT(gf_CheckStatus) THEN

   EXIT(FALSE);

UpdateDialog(1,BTC017);  //2005 09 07 - ED - NWD1.RC03;

gf_Disconnect();

EXIT(TRUE);



gf_Disconnect() Retboo : Boolean

UpdateDialog(1,BTC007);

IF (FTPC.Close()<>0) THEN

BEGIN

  lcu_EventLog.gf_InsertEventCode(3,3,0,'FTP','E-28-006','','','','','',FORMAT(FTPC.LastError()),'','','','',FALSE);

  CLEAR(FTPC);

  EXIT(FALSE)

END;

CLEAR(FTPC);

UpdateDialog(1,BTC018); 

EXIT(TRUE);

It's a critical issue because:
Our application must download and upload files at every period of time.
We can not see that the process is not responding in a short interval.
This problem locks the application: the users have to kill the task.
That often arrives because we work in a country with low internet bandwidth rate.

When removing the events on the SmartFTP automation (FTPC WithEvent=No), the problem do not seem to occur: the application is not blocked when the server closes the connection during login. This is not an acceptable solution for us. We use SmartFTP to handle event: we made a progress bar with transfer events.

Why the connect() function of SmartFTP library didn

Hello ...

Please try again with the latest version of the FTP Library:
https://www.smartftp.com/ftplib/download

Regards,
SmartFTP

Hello,

We have the same problem with the new version.
It happens here on another FTP server:

[20060411 09:46:18] SmartFTP FTP Library v1.5.8.3
[20060411 09:46:18] Resolving host name "ftpservername"
[20060411 09:46:18] Connecting to 200.150.140.150 Port: 21
[20060411 09:46:41] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
[20060411 09:46:41] Client closed the connection.

As reported above when an error occurs at this connection step, the connect() function of the library didn

Did you try to disable (or not handle) all the events from the FTP Library? Cause this may cause a dead lock.

Regards,
-Mat