File Transfer Protocol is commonly known as FTP. FTP mechanism is used by TCP/IP for transferring or copying file from one host to another. In the OSI model it works in the application layer.Transferring file from one host to another seems simple but in actual there are various problems which needed to be handled such as two systems may have different file name conversions or different ways to represent text and data , all these problems are solved easily with FTP.
Other than client-server application it establishes two connections between the hosts. One connection is used for data transfer and other is for control information such as commands and responses, the two connections made FTP more efficient. In control connection we need to transfer only one line of command or response at a time . Port 21 is used for control connections which remained open all the time of interactive FTP session where as data connection opens every time when a command that contains a transferring file is issued and gets closed after the file is transferred, it uses port 20 at the server site.
For the control connection the server have a passive open on the port 21 and it waits for the client where as client uses an ephemeral port and that tells an active open. While in data connection the client uses a small port as an passive open, the client sends this port number to the server using port command then the server receives the number and issues active open.
The communication between FTP client and server should be efficient as it can be on different computers using different operating system, file structures, etc. For control connection its same as TELNET or SMTP. Communication over data connection uses the following type:
a) ASCII file: ASCII(American Standard Code for Information Interchange) is the default format . The sender transforms the file into Network Virtual Terminal ASCII characters (NVT) and the receiver transform from NVT ASCII to its own representation.
b) EBCDIC file: If one or both end uses this encoding file can be transferred.
c)Image file: this is default for transferring binary files.
In stream mode data transmission the data is transmitted as stream of bytes from FTP to TCP,
in block mode data is transferred in the form of blocks and in compressed mode the data is compressed using run length encoding and then transferred.
FTP is not fully secured as its all transmission are in clear text ,there are several method such as “secure FTP”
TFTP and explicit FTP are various extension of FTP for the file transfer.