1. University MCA (AI/ML) Semester 1
  2. CAP7001
  3. Unit 6

CAP7001 · Unit 6: Application layer

Remote login, e-mail, file transfer, WWW and HTTP

26 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
  • TELNET: port 23, NVT, IAC 255, WILL/WONT/DO/DONT, plain text
  • Mail: UA, MTA (SMTP push), MAA (POP3 110 or IMAP 143 pull); MIME carries non-ASCII data

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.

Remote logging and TELNET

In local login the terminal is attached to the computer. In remote logging the user's keystrokes go to a TELNET client, across a TCP connection to the server's port 23, and into the remote operating system through a pseudoterminal driver; output comes back the same way.

  • NVT (Network Virtual Terminal): a common character set. Each side translates between its own format and NVT, so different systems interoperate.
  • In-band control: data and commands share one connection. The byte IAC (Interpret As Command, 255) marks the next byte as a command, for example EOF, IP (interrupt process) or AYT (are you there).
  • Option negotiation: WILL (I offer to enable an option), WONT (I refuse), DO (please enable it), DONT (please disable it). Options include echo, binary transmission and terminal type.
  • Modes: default (the client echoes and sends a whole line), character (each character is sent and the server echoes it), line (the client edits and echoes, then sends whole lines).
  • Security: everything, passwords included, travels in plain text. SSH (port 22) replaced TELNET with an encrypted session.

Electronic mail

Components: the user agent (UA) composes and reads mail; the message transfer agent (MTA) pushes mail with SMTP; the message access agent (MAA) lets the receiver pull mail with POP3 or IMAP. Path: UA -> SMTP -> sender's server -> SMTP -> receiver's server -> POP3 or IMAP -> receiver's UA. Web mail uses HTTP between the browser and its mail server.

  • SMTP (TCP 25): commands HELO, MAIL FROM, RCPT TO, DATA (the message ends with a line holding a single dot) and QUIT. Replies are 3-digit codes, such as 220 service ready, 250 OK and 354 start mail input.
  • MIME lets non-ASCII data such as images and other scripts travel over 7-bit ASCII SMTP, using headers such as Content-Type and encodings such as base64.
  • POP3 (TCP 110): simple; delete mode removes mail from the server after download, keep mode leaves a copy. Mail usually ends up on one device.
  • IMAP (TCP 143): mail stays on the server, with folders, searching, downloading of headers or parts, and the same view from several devices.

Exam trap: SMTP only pushes; the receiver always pulls with POP3, IMAP or HTTP.

Try two questions

Question 1 · Tier 3, Apply

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?

  1. 900 ms
  2. 1000 ms
  3. 1800 ms
  4. 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.

Question 2 · Tier 2, Understand

Why can a recipient NOT use SMTP to fetch mail from the recipient's own mail server?

  1. SMTP has no port number
  2. SMTP only works over UDP
  3. SMTP is a push protocol; retrieval needs a pull protocol
  4. SMTP can carry only plain text and no recipient addresses
Show the answer

C. SMTP pushes mail from a client to a server. The recipient's computer must pull mail when it chooses, which is what message access protocols do.

Why not A: SMTP uses port 25.

Why not B: SMTP runs over TCP.

Why not D: SMTP carries sender and recipient addresses.