FTP – File Transfer Protocol, a quite old TCP/IP based protocol for file transfers.
FTP supports common file operations including: upload, download, list files, delete files and others.
The communication is done with two channels (two sockets), a control channel and a data channel.
There are two modes for the selection of the second channel: active, which is the default, and passive.
Active mode should not be used, as it requires the FTP server to make an incoming connection to the FTP client. This is likely to fail on many networks. Always enable passive mode.
The communication is not encrypted with standard FTP. This means that passwords and other data can be sniffed more easily.
FTPS – FTP Secure, is an extended protocol that supports TLS / SSL encryption. Don’t confuse it with SFTP which is a completely different protocol.
FTPS is supported in B4J and B4A.
To make things more complicated, there are two modes for FTPS:
FTPS Implicit – the connection is encrypted from the beginning.
FTP Explicit – a regular connection is made and then the client requests to upgrade to an encrypted connection.
In B4A and B4J FTPS implicit is enabled with FTP.UseSSL = True and FTPS explicit is enabled with FTP.UseSSLExplicit = True. Only one of them should be enabled.
Implementation of FTP client is available in the Net / jNet / iNet libraries. The API is more or less the same and it is best to use it as explained here: [B4X] Net library (FTP, SMTP, POP) with Wait For
A FTP server, implemented in B4X, is also available: [B4X] FTP Server implemented with Socket and AsyncStreams
It is a nice example of network communication. This library is also included in B4A-Bridge and B4J-Bridge and allows browsing the remote device.