CAP7001 · Unit 6: Application layer
Remote login, e-mail, file transfer, WWW and HTTP
10 practice questions · in the ETE syllabus
Key points
- SMTP sends mail between servers; POP3 and IMAP retrieve it
- FTP uses control port 21 and a separate data connection
- HTTP is stateless and uses port 80
- Status codes: 200, 301, 304, 404
- Persistent and pipelined HTTP cut page load time
Remote login: Telnet (port 23) sends everything in plain text, whereas SSH (port 22) encrypts the session.
E-mail: the sender's user agent submits mail to its own mail server with SMTP (port 25). SMTP also carries the message between mail servers. The recipient then retrieves it with POP3 (downloads, port 110) or IMAP (manages mail on the server, port 143). SMTP pushes mail, POP3 and IMAP pull it.
FTP uses two TCP connections: a control connection on port 21 for commands, and a separate data connection (port 20 in active mode) for each transfer.
WWW and HTTP: a browser fetches objects named by URLs from servers on port 80 using requests such as GET, answered with status codes (200 OK, 301 moved, 304 not modified, 404 not found). HTTP is stateless; cookies add sessions. A conditional GET with If-Modified-Since returns 304 with no body when the cached copy is current.
Timing example: a base file plus 8 images, RTT 100 ms, counting the handshake and each request as 1 RTT. Non-persistent with no parallelism: 9 objects x 2 RTT = 1800 ms. Persistent: 1 + 9 = 10 RTT = 1000 ms. Persistent with pipelining: 1 + 1 + 1 = 3 RTT = 300 ms. Non-persistent with 4 parallel connections for the images: 2 + 2 x 2 = 6 RTT = 600 ms.
Exam trap: persistent connections save handshakes, but without pipelining each object still waits one RTT.
Try two questions
A web page has one base HTML file and 8 embedded images, all on one server. The RTT is 100 ms and transmission times are negligible. With non-persistent HTTP and no parallel connections, counting a TCP handshake as 1 RTT and each request and response as 1 RTT, how long does the full page take?
- 900 ms
- 1000 ms
- 1800 ms
- 1700 ms
Show the answer
C. Nine objects at 2 RTT each give 18 RTT, or 1800 ms.
Why not A: That counts one RTT per object and misses the handshake.
Why not B: That is the persistent case.
Why not D: That miscounts the objects.
How does FTP use TCP connections?
- A control connection on port 21 plus a separate data connection per transfer
- A single connection on port 20 that carries the commands and the files
- A UDP control channel together with a TCP data channel for files
- A new control connection opened again for each file name typed in
Show the answer
A. FTP separates control from data so commands can still be sent during a transfer.
Why not B: Commands and files use separate connections.
Why not C: Both FTP channels use TCP.
Why not D: The control connection stays open for the whole session.