David Goossens
Hello,
we are using smartFTP library with success. We only have a small problem when the following error occurs during connection (very few times):
[20051220 03:31:19] SmartFTP FTP Library v1.5.6.0
[20051220 03:31:19] Resolving host name "****"
[20051220 03:31:19] Connecting to ***** Port: ***
[20051220 03:31:20] No connection could be made because the target machine actively refused it.
[20051220 03:31:20] Client closed the connection.
OR
[20051220 03:27:23] SmartFTP FTP Library v1.5.6.0
[20051220 03:27:23] Resolving host name "****"
[20051220 03:27:23] Connecting to ***** Port: ***
[20051220 03:27:23] Connected to *****
[20051220 03:27:23] Server closed connection
In these cases, our application using smartFTP is blocked. It doesn't continue the process. We can not be advertised that the application is blocked.
These error happens very few time with our FTP Server (ProFTPd). So, the connection error can occur but our application should handle these cases and continue the process with a log message.
In our code, we check the return value of the connect() function :
IF FTPC.Connect()<>0 THEN
EXIT(FALSE)
We also regulary check the connection status :
gf_CheckStatus() retboo : Boolean
IF (gboo_Error) THEN
EXIT(FALSE);
IF (FTPC.ConnectionStatus<>2) THEN
BEGIN
lcu_EventLog.gf_InsertEventCode(3,3,0,'FTP','E-28-044','','','','','',FTPC.ConnectionStatus,'','','','',FALSE);
EXIT(FALSE);
END;
EXIT(TRUE);
We also check the event OnStatus :
FTPC::OnStatus(t : Integer;szText : Text[1024])
ltex1024_StatusText := '';
CASE t OF
3:
BEGIN
CASE szText OF
'1':ltex1024_StatusText := szText + ' : Unable to resolve host name.';
'2':ltex1024_StatusText := szText + ' : Connection to host failed.';
'3':ltex1024_StatusText := szText + ' : Timeout.';
ELSE ltex1024_StatusText := 'Unknown Local Error';
END;
END;
4:ltex1024_StatusText := szText;
ELSE ltex1024_StatusText := '';
END;
IF (ltex1024_StatusText <> '') THEN
BEGIN
lcu_EventLog.gf_InsertEventCode(2,5,0,'FTP','E-28-034','','','','','',
FORMAT(t),COPYSTR(ltex1024_StatusText, 1, 50),'','','',FALSE);
gboo_Error:=FALSE;
END;
Have you an idea of why our application is blocked in case of connection errors ?
Thanks in advance for your feedback,
David
we are using smartFTP library with success. We only have a small problem when the following error occurs during connection (very few times):
[20051220 03:31:19] SmartFTP FTP Library v1.5.6.0
[20051220 03:31:19] Resolving host name "****"
[20051220 03:31:19] Connecting to ***** Port: ***
[20051220 03:31:20] No connection could be made because the target machine actively refused it.
[20051220 03:31:20] Client closed the connection.
OR
[20051220 03:27:23] SmartFTP FTP Library v1.5.6.0
[20051220 03:27:23] Resolving host name "****"
[20051220 03:27:23] Connecting to ***** Port: ***
[20051220 03:27:23] Connected to *****
[20051220 03:27:23] Server closed connection
In these cases, our application using smartFTP is blocked. It doesn't continue the process. We can not be advertised that the application is blocked.
These error happens very few time with our FTP Server (ProFTPd). So, the connection error can occur but our application should handle these cases and continue the process with a log message.
In our code, we check the return value of the connect() function :
IF FTPC.Connect()<>0 THEN
EXIT(FALSE)
We also regulary check the connection status :
gf_CheckStatus() retboo : Boolean
IF (gboo_Error) THEN
EXIT(FALSE);
IF (FTPC.ConnectionStatus<>2) THEN
BEGIN
lcu_EventLog.gf_InsertEventCode(3,3,0,'FTP','E-28-044','','','','','',FTPC.ConnectionStatus,'','','','',FALSE);
EXIT(FALSE);
END;
EXIT(TRUE);
We also check the event OnStatus :
FTPC::OnStatus(t : Integer;szText : Text[1024])
ltex1024_StatusText := '';
CASE t OF
3:
BEGIN
CASE szText OF
'1':ltex1024_StatusText := szText + ' : Unable to resolve host name.';
'2':ltex1024_StatusText := szText + ' : Connection to host failed.';
'3':ltex1024_StatusText := szText + ' : Timeout.';
ELSE ltex1024_StatusText := 'Unknown Local Error';
END;
END;
4:ltex1024_StatusText := szText;
ELSE ltex1024_StatusText := '';
END;
IF (ltex1024_StatusText <> '') THEN
BEGIN
lcu_EventLog.gf_InsertEventCode(2,5,0,'FTP','E-28-034','','','','','',
FORMAT(t),COPYSTR(ltex1024_StatusText, 1, 50),'','','',FALSE);
gboo_Error:=FALSE;
END;
Have you an idea of why our application is blocked in case of connection errors ?
Thanks in advance for your feedback,
David