tfFtpRetr

Jump to: navigation, search

Table of Contents >> Application Reference >> FTP Client API


#include <trsocket.h>


int tfFtpRetr (
ttUserFtpHandle ftpUserHandleA,
ttUserFtpHandle ftpUserHandleB,
char * fromNamePtr,
char * toNamePtr
);


Function Description

This function is used to retrieve a file from remote FTP server (corresponding to 'ftpUserHandleA'). This function is implemented for both passive mode and normal mode, and also works with both one FTP server model and two FTP servers model.


  • One server model:
If the 'ftpUserHandleB' parameter is NULL, then the one-server model is used, and the operation could be either in server active mode or server passive mode. By default the server is in active mode. The user needs to call tfFtpTurnPasv() with the TM_FTP_PASSIVE_MODE_ON flag to turn the server in passive mode.
  • Two-server model:
If the 'ftpUserHandleB' parameter is non-NULL, then the two-server model is used, and the first session should be in passive mode, and the second session should be in active mode. The user needs to call tfFtpTurnPasv(), passing the 'ftpUserHandleA' parameter, and the TM_FTP_PASSIVE_MODE_ON flag.


Parameters

  • ftpUserHandleA
    The FTP session handle of the main FTP session to be operated on.
  • ftpUserHandleB
    The FTP session handle of the second FTP session for the two-server model.
  • fromNamePtr
    A pointer to the source filename string.
  • toNamePtr
    A pointer to the destination filename string.


Returns

  • TM_ENOERROR
    Success.
  • TM_EWOULDBLOCK
    The call is non-blocking and did not complete.
  • TM_EINVAL
    Invalid ftpSessionPtr or bad filename.
  • TM_EACCES
    Previous command has not finished.
  • TM_ENOTLOGIN
    Command requires user to be logged in, and user is not.
  • TM_ENOTCONN
    Command requires connection, and user is not connected.
  • TM_EOPNOTSUPP
    Command not supported by the user.
  • TM_FTP_XFERSTART
    Data connection already open; transfer starting.
  • TM_FTP_FILEOKAY
    File status okay; about to open data connection.
  • TM_FTP_DATAOPEN
    Can't open data connection.
  • TM_FTP_XFERABOR
    Connection trouble, closed; transfer aborted.
  • TM_FTP_LOCALERR
    Requested action aborted: local error in processing.
  • TM_FTP_FILENAVAIL
    Requested file action not taken: file unavailable.
  • TM_FTP_NAVAIL
    Requested action not taken: file unavailable.
  • TM_FTP_SYNTAXCMD
    Syntax error, command unrecognized.
  • TM_FTP_SYNTAXARG
    Syntax error in parameters or arguments.
  • TM_FTP_SERVNAVAIL
    Service not available, closing FTP connection.
  • TM_FTP_NOTLOGIN
    Not logged in.


Table of Contents >> Application Reference >> FTP Client API