What are the FTP Connections?



The two types of Connections in FTP are as follows −

Control Connection

There are two steps −

  • The server issues a positive open on the well-known port 21 and waits for a client.
  • The client uses an ephemeral port and issues an active open.

The connection remains open during the whole process.

Data Connection

The data connection facilitates the well-known port 20 at the server site. The following steps display how FTP creates a data connection.

  • The user, not the server, issues a passive open using an ephemeral port.
  • The client assigns this port number to the server using the PORT command.
  • The server receives the port number and issues an active open using the wellknown port 20, and the received ephemeral port number.

Communication over Control Connection

FTP uses a similar approach as TELNET or SMTP to communicate across the control connection. It uses the NVT ASCII character set. Communication is achieved through command and responses. Each command or response is only one short line; therefore, we need not worry about file format or file structure.

Communication over the data connection

In this, the client must define the type of file to be transferred via transmission mode. Before sending the document through the data connection, we arrange for transmission through the control connection.

The heterogeneity problem is resolved by representing three attributes of communication.

  • File Type
  • Data Structure
  • Transmission Mode

So, the sender must determine the following attributes of the file.

Type of the file to be transferred

The file to be transferred can be ASCII, EBCDIC or Image file. If the file has to be shared as ASCII or EBCDIC, the destination should be ready to accept it in that mode. The third type is used if the file is to be transferred without any notice to its content. Thus third and last Type-Image file is a misnomer. It has nothing to do with images. It implies a binary file that is not interpreted by FTP in any manner and sent as compiled programs are examples of image files.

The structure of the data

FTP can change a file across connections by interpreting its structure in the ways, and the structure can be byte-oriented structure and Record oriented structure.

The transmission mode

FTP can transfer a file using one of the three transmission modes described here.

  • Stream mode − If the file is assigned in stream mode, which is the default mode, data is delivered from FTP to TCP as a continuous stream of data.
  • Block mode − Data can be delivered from FTP to TCP in terms of blocks. In this case, each data block follows a three-byte header. The header's first byte is called block descriptor, whereas the remaining two bytes define the size of the block and offset within the block.
  • Compressed mode − If the file to be transferred is significant, it can be compressed before it is sent. Usually, the Run Length Encoding (RLE) compression method is used for compressing a file.

Advertisements