Network Kings, India’s Leading IT Career Training Academy
Ever wondered how files get exchanged over the wires connecting different servers, clients, routers, and switches even if more than one network device is requesting different files from servers at the same time?
It is surprising to note that you get the same file you requested even if we have thousands and lacs of requesting devices, asking for different files at the same time, isn’t it?
FTP, also known as File Transfer Protocol can do wonders.
Transfer of files between computers (clients) and servers has become a crucial part of our everyday life in the current digital era. Be it downloading any book PDF or movie, uploading or downloading documents, is a reliable and efficient method to attain.
By the end, you’ll have a clear understanding of FTP protocol and its importance in networking.
The basics of the FTP protocol are as follows-
FTP is a standard File transfer protocol which works on APPLICATION LAYER and uses TCP which makes it a reliable protocol. As we don’t want to lose any bit of information, hence use of TCP is a better choice than using UDP as UDP is a connectionless protocol and it may lose some data packets and hence incomplete file transfer.
It works on the client-server model where the client initiates the connection and request file from the server: (PORT 20 and PORT 21).
(Further, we will discuss why it uses two ports)
Consider FTP as a courier service that delivers packages to your doorstep securely.
FTP acts as a mediator between the Client and the Server.
FTP uses two different protocol numbers because it operates using 2 different connections
In this way, FTP is using Port 20 as well as Port 21.
Let us discuss how the whole process of file transfer takes place from start to end.
1. Establishing Connection: – The client sends a request to a server using the domain name (or IP ADDRESS of the server) at PORT 21.
2. Once the connection is made, the server asks for authentication from the client, such as its username and password to ensure that only authorized users can access the server’s files.
3. Now the client can navigate the files stored in a server using FTP commands.
For example– The client used the get command followed by file name to download a file. The put command is used by the client to upload a file to the server.
4.The server sends some response codes to the client to indicate the status of the transfer.
For example– “150” is used to tell the client that the server is ready to send the file, and “226” denotes a successful transfer of the file to the client and closing of the data connection.
5. If the connection is no more needed and the client does not need a further connection to the server, the connection can be terminated using the “quit” command.
User: This command sends the user authentication to the server.
Pass: This command sends the user password to the server
MKD: Make Directory: Creates a new directory on the remote server.
Bell: When any command completes, this command sounds like a bell.
Bye: It is used to terminate the FTP session and exit
CD: This command is used to change the directory on the remote system.
Delete: It is used to delete a file in the current remote directory.
Get: It is used to copy a file from the server to the client’s device.
Mdelete: It is used to delete multiple files at once.
Mget: It is used to copy multiple files from the remote machine to the local machine
Put: This command is used to copy a file from the user device to the server device
Pwd: This command is used to search the path name of the local directory on the remote system
Remote help: It is used to display the remote system information.
Rename: This command is used to rename the file of the system.
Send: It is used to send a file.
Type: It is used to set the file transfer type.
150: File status okay, about to open data connection.
200: Command Okay
226: Closing data connection, File transfer successful
227: Entering passive mode.
230: User logged in.
250: Requested file action completed.
331: user name authenticated, need a password
421: Service not available
500: Syntax error
550: Requested action not taken; file unavailable.
Let’s have a look at some important scenarios where FTP plays an important role-
FTP protocol has some advantages and disadvantages.
ADVANTAGES: –
DISADVANTAGES: –
FTP is in used for decades and it solves our major problem of file transfer, but there are some better protocols which are more secure than FTP.
Besides a few disadvantages, FTP is a widely used protocol. It is simple yet effective working mechanism makes it easier to transfer even large files easily by following the client-server model and connecting between client and server using TCP, making FTP a reliable protocol.