EC-11.5 End to End: TCP, UDP and the Price of Reliability

en

What this is and why it exists

This is where a reader stops thinking of reliability as something a network has. It becomes something built at the ends, at a measurable cost.

It is also where delay and throughput separate. That distinction matters for anyone who will later be asked why a link with plenty of capacity still feels slow. It is one of the most common questions asked about a network.

The vocabulary

  • Port — a number identifying which program on a machine a message belongs to.
  • Datagram service — delivery with no acknowledgement, ordering or retransmission.
  • Sequence number — a number identifying a byte's position in a stream.
  • Acknowledgement — a message reporting what has been received.
  • Handshake — the exchange that establishes agreed starting numbers.
  • Flow control — preventing a fast sender from overwhelming a slow receiver.
  • Congestion control — preventing many senders from overwhelming the network.
  • Round-trip time — the delay for a message and its acknowledgement.
  • Bandwidth-delay product — the data in flight needed to keep a link busy.

The mental model

The network layer delivers a packet to a machine and stops. Something has to say which program on that machine it is for, and the port number is that something. Every transport protocol starts there.

Then comes the choice that shapes everything else. Reliability is optional, and choosing to go without it is often correct.

An unreliable transport sends a message with no acknowledgement, no ordering and no retransmission. That is exactly right when a late message is worthless: voice, video, live measurement, a game position. Resending a sound from two seconds ago helps nobody, and the effort spent doing it delays the next one.

The reliable transport is the more interesting construction. It builds an ordered, complete stream on top of a service that may lose, duplicate and reorder.

The mechanism is three ideas. Number every byte. Have the receiver report what has arrived. Resend anything not reported within a reasonable time. That is the whole of reliability, and everything else in the protocol exists to make it efficient rather than to make it work.

Connection setup exists because both ends must agree on starting numbers before any data flows, and both must know that the other agreed. That takes three messages, which is the minimum for mutual agreement over an unreliable channel.

Closing takes more, because each direction is closed separately and one end may still have data to send after the other has finished. A waiting period at the end is needed so that a delayed old message cannot be mistaken for part of a new connection.

Now the two controls that are constantly confused. Flow control protects the receiver. Congestion control protects the network.

Flow control is simple: the receiver advertises how much buffer space it has and the sender does not exceed it. The information is exact, because the receiver knows its own state.

Congestion control is hard, because no message ever arrives saying the network is full. The sender must infer it, and the signal it uses is loss. Send more until something is lost, then back off sharply, then increase gently again. That is a control loop with no direct measurement of the thing being controlled. It took decades to get right and is still being improved.

Finally, throughput and delay. A sender can have at most one window of data outstanding, and it must then wait a round trip for acknowledgement.

Throughput is therefore the window size divided by the round-trip time. Once the window is the limit, the link rate does not enter into it at all. A very fast link across the world, with a small window, delivers a fraction of its capacity.

That is the answer to why a fast link feels slow. It is the same bandwidth-delay reasoning met at the link layer, with the round trip now measured in milliseconds.

What you should now be able to explain or do

  • Say what a port adds above the network layer's delivery to a machine.
  • Choose between a reliable and an unreliable transport from the value of a late message.
  • Describe how numbering, acknowledgement and retransmission build a reliable stream.
  • Explain why connection setup needs three messages and why closing needs a waiting period.
  • Distinguish flow control from congestion control by what each one protects.
  • Compute throughput from window size and round-trip time, and explain a slow fast link.

Check yourself

When a late message is worthless. Voice, video and live measurement all prefer a gap to a stale retransmission that also delays whatever comes next.

Because nothing tells the sender the network is full. Loss is the only signal available, so the sender probes upward, retreats when something is lost, and probes again.

The window size. A sender can have only one window outstanding before waiting a round trip. Throughput is therefore the window divided by that delay, regardless of link rate.

So that a delayed message from the old connection cannot arrive during a new one on the same ports. It would otherwise be mistaken for part of it.

Go deeper

Back to End to End: TCP, UDP and the Price of Reliability: work through the checklist