Back to the 2020 paper

Module 5: Application Layer & Security

20207m

What kinds of file types can FTP transfer? What are the three FTP transmission modes? Describe the functions of the two FTP connections. How does storing a file differ from retrieving a file?

Worked SolutionAI Assisted

File Transfer Protocol (FTP)

1. File types FTP can transfer

FTP defines three file types so that files stored in different formats can be moved between unlike machines:

File type Purpose / conversion
ASCII Text files. Converted to/from the Network Standard ASCII (NVT-ASCII, 7-bit, CRLF line ends) at each end — used for editor commands and text.
EBCDIC Mainframe (EBCDIC-coded) text. Converted to ASCII at the sending side and back to EBCDIC at the receiving side.
Image (binary) Any file treated as an uninterpreted byte stream — copied exactly with no conversion, for executables, graphics, compressed files etc.

2. The three transmission modes

  • Stream mode — data flows as a continuous stream of bytes over the TCP connection; records have no length field, the receiver must delimit them itself. Flow control is done by TCP.
  • Block mode — data is cut into blocks, each preceded by a 3-byte header (block length + descriptor byte: B = beginning, I = intermediate, D = end, E = error) so the receiver knows record boundaries.
  • Compressed mode — uses run-length encoding: a sequence of n identical bytes is sent as (count, byte), which suits highly repetitive data such as images.

3. Functions of the two FTP connections

Control connection Data connection
Ports server 21 ↔ client ephemeral server 20 ↔ client ephemeral
Lifetime Opened at start, stays open for the whole session, closed at the end Opened and closed for every data transfer (e.g. each LIST, RETR, STOR)
Carries ASCII commands and replies (USER, RETR, STOR, response codes) The actual file data / directory listing
Mode Always client → server initiation Server initiates it back to the client (active mode)

FTP is therefore an out-of-band protocol: the control connection carries instructions while the data connection carries the payload.

4. Storing a file vs retrieving a file

  • Retrieving (RETR) = download: the client asks the server for a file, so data flows server → client on the data connection.
  • Storing (STOR) = upload: the client sends a local file to the server, so data flows client → server on the (newly opened) data connection; the server creates or overwrites the file (STOU stores under a unique name, APPE appends).

The only difference is the direction of data flow — both use the same two-connection mechanism, and both are initiated by a command on the control connection.

Similar questions

Free AppAndroid App

Coursify Android App

Generate AI courses, take quick quizzes between classes, and master complex engineering concepts on the go.