One key role of protocols is to define the syntax (ie structure) of requests and responses. To do this, protocols need to define where one exchange ends and the next one begins. Give two plausible ways in which a text based protocols can indicate the end of an exchange.
Try an answer before revealing the guidance below.
Key Concepts
- Delimiter / terminator
- Length field
- Connection close
- CRLF
Answer Approach
- Think about how HTTP ends its header section.
- Think about how SMTP ends a message body.
- Think about how a receiver can know in advance how many bytes to read.
Full Answer
Answer status: Draft answer (unofficial). Revision notes, not an official marking scheme.
(1) A special delimiter sequence marks the end, such as a blank line (CRLF CRLF) ending HTTP headers or a line containing only “.” (CRLF.CRLF) ending an SMTP message. (2) A length field announces how many bytes follow, such as HTTP’s Content-Length header, so the receiver reads exactly that many bytes. (Closing the connection can also mark the end of a response.)
Shortcuts: K concepts · A approach · F answer · R reviewed · B bookmark · ← / → previous / next