KB Article #177142

CFT API C issue - synchronous file transfer requests in error returns 0

Problem

- CFT API C issue: synchronous file transfer requests in error returns RC=0

Notes:
- Use of parameters MAXDURATION,WSTATES,WTIMEOUT
- Same CFTUTIL command works well.


Trace of the program calling CFT API:
.../...
First call work well, the cftau function waits until the end of the file transfer:
28/05/2015 18:36:18,995 00006203 (D) : CFT API CALL : cftau : (COM,C=/home/axway/CFT4FTP/etc/cftcom.cfg)
28/05/2015 18:36:19,002 00006203 (D) : CFT API RET : cftau "COM" 0 (00000000H)
28/05/2015 18:36:19,002 00006203 (D) : CFT API CALL : cftau(SEND,PART='PARIS',IDF='CFT4FTP_PUT_axway',FNAME='/home/axway/axway-install/ComposerCore_3.8.0_Install_linux-x86-64_BN28609.zip',NFNAME='/home/axway/CFT4FTP/in/ftpput-recv',MAXDURATION=10,WSTATES=X,WTIMEOUT=615,APPCYCID=CFT4FTP0620315052818361800001,APPOBJID=CFT4FTPrequest)
28/05/2015 18:36:31,553 00006203 (D) : CFT API RET : cftau (SEND) 0 (00000000H)
28/05/2015 18:36:31,553 00006203 (D) : CFT API CALL : cftau (CLOSEAPI)
28/05/2015 18:36:31,553 00006203 (D) : CFT API RET : cftau "CLOSEAPI" 0 (00000000H)

Second call work well, the cftau function waits until the end of the file transfer:
28/05/2015 18:36:31,579 00006203 (D) : CFT API CALL : cftau : (COM,C=/home/axway/CFT4FTP/etc/cftcom.cfg)
28/05/2015 18:36:31,580 00006203 (D) : CFT API RET : cftau "COM" 0 (00000000H)
28/05/2015 18:36:31,580 00006203 (D) : CFT API CALL : cftau(RECV,PART='PARIS',IDF='CFT4FTP_GET_axway',NFNAME='/home/axway/axway-install/ComposerCore_3.8.0_Install_linux-x86-64_BN28609.zip',FNAME='/home/axway/CFT4FTP/in/ftpget-recv',MAXDURATION=10,WSTATES=X,WTIMEOUT=615,APPCYCID=CFT4FTP0620315052818361800001,APPOBJID=CFT4FTPrequest)
28/05/2015 18:36:43,603 00006203 (D) : CFT API RET : cftau (RECV) 0 (00000000H)
28/05/2015 18:36:43,603 00006203 (D) : CFT API CALL : cftau (CLOSEAPI)
28/05/2015 18:36:43,604 00006203 (D) : CFT API RET : cftau "CLOSEAPI" 0 (00000000H)
.../...

Third call should return an error, the sent file does not exist, but the cftau function returns 0:
28/05/2015 18:36:43,619 00006203 (D) : CFT API CALL : cftau : (COM,C=/home/axway/CFT4FTP/etc/cftcom.cfg)
28/05/2015 18:36:43,620 00006203 (D) : CFT API RET : cftau "COM" 0 (00000000H)
28/05/2015 18:36:43,620 00006203 (D) : CFT API CALL : cftau(SEND,PART='PARIS',IDF='CFT4FTP_PUT_axway',FNAME='/home/axway/axway-install/file_not_exist',NFNAME='/home/axway/CFT4FTP/in/ftpput-recv',MAXDURATION=10,WSTATES=X,WTIMEOUT=615,APPCYCID=CFT4FTP0620315052818361800001,APPOBJID=CFT4FTPrequest)
28/05/2015 18:36:43,646 00006203 (D) : CFT API RET : cftau (SEND) 0 (00000000H)
28/05/2015 18:36:43,646 00006203 (D) : CFT API CALL : cftau (CLOSEAPI)
28/05/2015 18:36:43,646 00006203 (D) : CFT API RET : cftau "CLOSEAPI" 0 (00000000H)
.../...

Fourth call should return an error, the sent file does not exist, but the cftau function returns 0:
28/05/2015 18:36:43,669 00006203 (D) : CFT API CALL : cftau : (COM,C=/home/axway/CFT4FTP/etc/cftcom.cfg)
28/05/2015 18:36:43,669 00006203 (D) : CFT API RET : cftau "COM" 0 (00000000H)
28/05/2015 18:36:43,669 00006203 (D) : CFT API CALL : cftau(RECV,PART='PARIS',IDF='CFT4FTP_GET_axway',NFNAME='/home/axway/axway-install/file_not_exist',FNAME='/home/axway/CFT4FTP/in/ftpget-recv',MAXDURATION=10,WSTATES=X,WTIMEOUT=615,APPCYCID=CFT4FTP0620315052818361800001,APPOBJID=CFT4FTPrequest)
28/05/2015 18:36:43,683 00006203 (D) : CFT API RET : cftau (RECV) 0 (00000000H)
28/05/2015 18:36:43,683 00006203 (D) : CFT API CALL : cftau (CLOSEAPI)
28/05/2015 18:36:43,683 00006203 (D) : CFT API RET : cftau "CLOSEAPI" 0 (00000000H)
.../...


Resolution

- The result of the command performed through CFT API function cftau should be check by calling the function:
rc = cftau("GETXINFO",(char*) &cftinfo);

- The information returned by CFT API in structure cftinfo is correct and it is no issue there.

- Using GETXINFO allows to get information about the error (file transfer status, diagi, diagp) unlike the cftau error code which refers to API specific errors.