Computer Networks · TEE · papers
Q7(c) · FTP connections
2025-02-19 · 2023-24 / 2024-25
Actual paper; 100 marks attempted. Current-syllabus alignment is stated per question.
Q7(c). Explain the process of file transfer using FTP protocol with a diagram. Compare communication over control connection and communication over data connection. [10 marks]
Answer
File Transfer Protocol (FTP) transfers files between a client and server using TCP and separates commands from file data. This separation is its central design feature. Its control connection remains available across multiple operations, while data connections carry file bytes or directory listings.
Diagram: FTP: separate control and data connections. Labels: FTP: separate control and data connections | FTP: separate control and data connections | Client → server TCP port 21 | Control: USER, PASS, CWD, TYPE, RETR/STOR/LIST, QUIT; server replies. | Active mode: server initiates data | Client provides a listening endpoint; traditional server data source port is 20. | Passive mode: client initiates data | Server advertises an endpoint; client connects to that selected port. | Data connection carries file/listing bytes | Command channel stays separate; another operation can open another data connection.
| Connection | Function | Lifetime / ports |
|---|---|---|
| Control | Commands and replies: USER, PASS, CWD, TYPE, LIST, RETR, STOR, QUIT | Client connects to server TCP port 21; normally kept for the session |
| Data | File contents and directory listing data | Opened as needed; separate from command channel |
How a transfer works
- Client opens the control connection and exchanges server greeting, login commands and replies. Plain FTP sends credentials/data without encryption.
- Client chooses transfer settings such as binary/image mode for arbitrary bytes, and requests the needed working directory/operation.
- In active FTP, the client provides a listening endpoint and the server initiates the data connection, traditionally from server port 20.
- In passive FTP, the server returns a listening endpoint and the client initiates the data connection to that chosen server port. Therefore “FTP data always uses server port 20” is wrong.
- RETR downloads a file; STOR uploads a file; LIST returns a directory listing over the data connection. Control replies report progress/completion. The session can continue for another transfer.
- QUIT ends the control session.
FTP over TLS (FTPS) protects FTP connections. SFTP is a separate SSH-based file-transfer protocol, not “FTP using an SSH port”. These names should not be treated as interchangeable.
Yaad rakho: Control commands, data file; passive mein client dono connect karta.