File Transfer Protocol
FTP (File Transfer Protocol) is the simplest and most secure way to exchange files over the Internet. Transferring files from a client computer to a server computer is called “uploading” and transferring from a server to a client is “downloading”. To access an FTP server, users must be able to connect to the internet or an intranet (via a modem or local area network) with an FTP client program. FTP doesn’t really move, it copies files from one computer to another. FTP is the file transfer protocol in the Internet’s TCP/IP protocol suite’s Application Layer.
Goals of FTP:
- Sharing of files
- Indirect use of remote computers
- Handle different file systems
- Transfer data reliably and efficiently
- Some commonly used FTP clients that include the following:
- Fire FTP
This request is initiated by the client.
Allowing the FTP to begin
Store, delete, lookup, open and close
Allows client to interact with the server before they download or upload a file.
Server will inform the client that it is ready to either receive or send a file.
The sub-commands used in this transaction are “ready to send” and “ready to receive”.
The actual transaction will occur in the transfer step.
Two types of terminate transactions
- Successful terminate
- Unsuccessful terminate
Data transfer modes:
STREAM: file is transmitted as a stream of bytes.
BLOCK: file is transmitted as a series of blocks preceded by headers containing count and descriptor code (EOF, EOR, restart marker).
COMPRESSED: uses a simple compression scheme – compressed blocks are transmitted.
Types of connection:
When an FTP client connects to an FTP server it opens a connection to the FTP control port 21. Then the client tells the FTP server whether to establish an active or passive connection.
The type of connection chosen by the client determines how the server responds and on what ports transactions will occur.
When an active connection is established, the server opens a data connection to the client from port 20 to a high range port on the client machine.
All data from the server is then passed over this connection.
When a passive connection is established, the client asks the FTP server to establish a passive connection port, which can be on any port higher than 10,000.
The server then binds to this high-numbered port for this particular session and relays that port number back to the client. The client then opens the newly bound port for the data connection.
The FTP commands:
There are three different types of FTP commands:
- Access control commands
- Transfer parameter commands
- Service Commands
FTP uses the services of TCP. It needs two TCP connections. The well-known port 21 is used for the control connection, and the well-known port 20 is used for data connection.
Also Read: How to Install WordPress Using FTP
When retrieving non-text files, you must use Binary Mode, otherwise the file(s) get messed up.
FTP is case sensitive.
Be aware that software files on the net may have a virus.