Datasheet

Flyport Wi-Fi and Ethernet Programmer's guide framework 2.3 (rev 1.0) www.openpicus.com
FTP Client
FTP Client can handle file exchange between Flyport and PC (or any other FTP Server).
Flyport can only be the Client, so other devices have to provide the FTP server service (for example a
PC with FileZilla Server).
Basically, an FTP connection is a special set of instructions that use TCP protocol. With those
commands the files and directories handling, user login, logout, etc. can be controlled.
The FTP library provides two kind of functions: the "high level" and the "low level" functions. With
the first ones it's possible to directly connect Flyport to a server and easily send commands or
read/write remote files. All the server answers are managed by framework's functions simply
requiring the user to give the connection parameters of file names.
The "low level" functions include the basic set of FTP commands to open a command/data socket
and read or write data and commands on it. With this kind of functions it's possible to have a greater
control of FTP operations, but all the management of the timeouts and answers' parsing it's up to the
users. For the most of applications, using high level functions is the fastest and easiest solution.
FTP High level functions
This instruction set contains functions to automatically connect to an FTP, to manage file
reading/writing and to send commands to the server without the user has to manage the timings or
parse the server messages. A set of possible error codes are returned in case operation is not
successful. Details on returns can be found in single function's description.
A complete list of error codes follows:
Error Code Define (value) Description
FTP_ERR_NOT_CREATED (-1)
A problem occurred while creating a specified FTP socket. Not
error in connection, maybe some internal problem in Flyport
(maybe no more sockets available).
FTP_ERR_SERV_NOT_FOUND (-2)
FTP server was not found. Maybe IP address was wrong, or
maybe a firewall doesn't allow Flyport to reach the server.
FTP_ERR_WRONG_ANSWER (-3)
Unexpected answer code from server. Operation is aborted.
FTP_ERR_WRONG_LOGIN (-4)
Login went wrong, caused by wrong username/password.
FTP_ERR_SERV_TIMEOUT (-5)
The server didn't answered within the expected timeout.
Operation is aborted.
FTP_STREAM_INVALID_OP (-6)
User has attempted an invalid stream operation, for example
trying to write on a not-opened stream.
FTP_DATA_NO_CONNECTED (-7)
An operation requiring a data socket (for example append to
a file) failed going in passive mode.
50