Functions

Functions

FTP_client_typeFTP_get_control (char *ftp_server, user_type *user)
 Allocate FTP client structure and control buffer. More...
 
int32_t FTP_free_control (FTP_client_type *FTP_client)
 Close control structure and free all associated buffers. More...
 
int32_t FTP_send_control (FTP_client_type *FTP_client, char *command)
 Send a FTP control message. More...
 
int32_t FTP_get_reply_code (FTP_client_type *FTP_client)
 Wait for reply code from FTP server. More...
 
int32_t FTP_connect (FTP_client_type *FTP_client, int32_t connect_timeout)
 Connect to FTP server. More...
 
int32_t FTP_server_login (FTP_client_type *FTP_client)
 Perform FTP server login. More...
 
int32_t FTP_server_logout (FTP_client_type *FTP_client)
 Logout from FTP server. More...
 
int32_t FTP_set_file_buffer (FTP_client_type *FTP_client, char *buffer, int32_t size)
 Set user buffer for file transfer. More...
 
int32_t FTP_retrieve_file (FTP_client_type *FTP_client, char *file_name, char type)
 Retrieve a file from FTP server. More...
 
int32_t FTP_store_file (FTP_client_type *FTP_client, char *file_name, char type)
 Send file to FTP server. More...
 

Detailed Description

Function Documentation

FTP_client_type* FTP_get_control ( char *  ftp_server,
user_type user 
)
Parameters
ftp_server- IP address string
user- registered FTP user
Returns
FTP client control structure
Library:
ftpc.lib
Prototype:
ftplib.h
Examples:
FTPClient.c.
int32_t FTP_free_control ( FTP_client_type FTP_client)
Parameters
FTP_client
Returns
Always 1
Library:
ftpc.lib
Prototype:
ftplib.h
Examples:
FTPClient.c.
int32_t FTP_send_control ( FTP_client_type FTP_client,
char *  command 
)
Parameters
FTP_client- connected FTP client
command- string command to send, e.g. "STOR readme.txt"
Returns
  • (0) - Error
  • >0 - FTP server reply code
Library:
ftpc.lib
Prototype:
ftplib.h
int32_t FTP_get_reply_code ( FTP_client_type FTP_client)
Parameters
FTP_client- connected FTP socket
Returns
  • success - reply code
  • error/timeout - -1
Library:
ftpc.lib
Prototype:
ftplib.h
int32_t FTP_connect ( FTP_client_type FTP_client,
int32_t  connect_timeout 
)
Parameters
FTP_client- client to connect
connect_timeout- timeout for connection attempt
Returns
  • TRUE if connection successfully established
  • FALSE in case of errors
Note
You may identify the error condition by reading socket->error_code. Possible error codes:
  • SO_IN_USE: socket already connected
  • SO_TIMED_OUT: timeout run out
Library:
ftpc.lib
Prototype:
ftplib.h
Examples:
FTPClient.c.
int32_t FTP_server_login ( FTP_client_type FTP_client)
Parameters
FTP_client- connected FTP client
Returns
  • 230 - Successful login
  • !230 - Error
Library:
ftpc.lib
Prototype:
ftplib.h
Examples:
FTPClient.c.
int32_t FTP_server_logout ( FTP_client_type FTP_client)
Parameters
FTP_client- connected FTP client
Returns
  • 230 - Success
  • !230 - Error
Library:
ftpc.lib
Prototype:
ftplib.h
Examples:
FTPClient.c.
int32_t FTP_set_file_buffer ( FTP_client_type FTP_client,
char *  buffer,
int32_t  size 
)
Parameters
FTP_client- connected FTP client
buffer- buffer for file transfer
size- buffer size for file transfer
Returns
0 - setting successful
Library:
ftpc.lib
Prototype:
ftplib.h
Examples:
FTPClient.c.
int32_t FTP_retrieve_file ( FTP_client_type FTP_client,
char *  file_name,
char  type 
)
Parameters
FTP_client- FTP client with connected control socket
file_name- file name to download
type- file type 'A' for ASCII, 'I' for binary
Returns
  • 0 = Out of memory error or no buffer space
  • 226 = download successful
  • 425 = port in use
  • 500 = error
  • and many other see RFC
Library:
ftpc.lib
Prototype:
ftplib.h
Examples:
FTPClient.c.
int32_t FTP_store_file ( FTP_client_type FTP_client,
char *  file_name,
char  type 
)
Parameters
FTP_client- FTP client with connected control socket
file_name- file name to upload
type- file type 'A' for ASCII, 'I' for binary
Returns
  • 0 = Out of memory error or no buffer space
  • 226 = upload successful
  • 425 = port in use
  • 500 = error
Library:
ftpc.lib
Prototype:
ftplib.h
Examples:
FTPClient.c.