Interview prompt
Explain tcp provides an ordered byte stream to an engineer who understands the surrounding system but has not used this technique. Walk from its contract to a concrete operation, then discuss where it fails or becomes expensive.
A strong answer
TCP provides applications with a reliable, ordered byte stream over an IP network. It tracks sequence numbers, acknowledges received ranges, retransmits data when needed, and applies flow and congestion control. The application sees a stream of bytes rather than message boundaries.
A sender can write a short buffer, but TCP may combine it with other data or split it across segments. The receiver must parse its own framing format, such as a fixed length, delimiter, or length prefix. An acknowledgement confirms transport-level receipt, not that the remote application completed a business operation.
A complete answer also calls out the assumptions that control correctness. Connections can stall, reset, or time out, and a successful local write does not prove remote delivery. Flow control protects the receiver; congestion control responds to network conditions. Retrying an application operation after uncertainty can duplicate side effects unless the operation is idempotent.
Close by describing one representative test or measurement. An API sends two JSON objects over one TCP connection. Explain why a single read call cannot be assumed to return exactly one complete object, and propose a framing strategy.
Follow-up questions
Answer the follow-ups in the frontmatter. Use the linked article for the concept and the trace to make the explanation concrete.