Topic lessonTopic: networking foundations
TCP vs UDP: ports, listeners and message boundaries
TCP provides an ordered byte stream; UDP carries datagrams. Both use port numbers, but the same number does not make them interchangeable. Use a fictional document service to distinguish an intended endpoint, TCP listening and establishment, and an application response.
Read an IP/transport/port endpoint, explain stream versus datagram boundaries, and limit a connection claim to the evidence supplied.
An IP address identifies a network-layer endpoint; a transport port helps distinguish a TCP or UDP endpoint. All examples are fictional and use documentation addresses and names. No connection, OS command, AWS account or log submission is required.
Read the address, transport and port together
Call the document service docs.example. Looking up destination information through DNS differs from finding a working application there. Our illustrative client is 192.0.2.10:50324, with intended target 192.0.2.20:443/TCP. The source port 50324 is chosen for this example, not an OS-wide default.
| Field | Value | Meaning |
|---|---|---|
| Destination IPv4 | 192.0.2.20 | The address selected; reachability remains unknown. |
| Transport | TCP | The transport intended for this example, distinct from UDP. |
| Destination port | 443 | The TCP destination port; no certification of a running or safe application. |
TCP/443 and UDP/443 are different transport endpoints. A registered service name cannot establish the actual application, expected response or safety. Keep address, transport and port together.
- Client 192.0.2.10 :50324 → Target 192.0.2.20 TCP/443Specified endpoint; sending, reachability and establishment unverified
- Client 192.0.2.10 :50324
- 192.0.2.10:50324
- Target 192.0.2.20 TCP/443
- 192.0.2.20:443/TCP
Compare a TCP stream with UDP datagrams
TCP (Transmission Control Protocol) offers applications an ordered byte stream, with mechanisms including retransmission. One write need not correspond to one read. The application protocol must define message length or termination.
Suppose an application writes AB, then CD. When the same four bytes are received in order, possible reads include ABCD, or A followed by BCD. These are alternative groupings, not measured packets or timing.
- Write AB then CD → Bytes ABCDWrite boundaries are not preserved
- Bytes ABCD → Alternative 1: ABCDAlternative 1; not a measurement
- Bytes ABCD → Alternative 2: A / BCDAlternative 2; not simultaneous duplication
- Write AB then CD
- AB, then CD
- Bytes ABCD
- A B C D (the same four bytes)
- Alternative 1: ABCD
- Read ABCD together
- Alternative 2: A / BCD
- Read A, then BCD
UDP (User Datagram Protocol) handles individual datagrams. Sending AB and CD as separate datagrams does not make UDP guarantee delivery, ordering or duplicate protection. OS receive APIs and insufficient-buffer behavior are outside this lesson.
| Aspect | TCP | UDP |
|---|---|---|
| Data unit | Ordered bytes without preserving write boundaries. | Datagrams, without TCP establishment. |
| Higher-layer concerns | Message framing, protection and application meaning. | Any required delivery mechanisms, protection and application meaning. |
| Not established | A guarantee that every attempt succeeds. | A conclusion that every application is unreliable. |
Listening differs from establishment and application response
A TCP listener waits for an incoming connection request, potentially at a particular local address. Having a listener differs from having a usable route and applicable traffic permissions from a given peer. This lesson gives no OS or cloud configuration procedure.
The fictional observations below concern one attempt between a named client and its direct TCP peer. A peer is the other endpoint of that connection. If a proxy or load balancer terminates the connection, that observation does not establish a further connection to the application behind it.
| Given note | Supported conclusion | Still unknown |
|---|---|---|
| IP and TCP/443 appear in configuration | An intended target is specified. | Sending, reachability, listener and establishment. |
| Establishment with the named direct peer was observed in this attempt | Evidence about that peer and TCP attempt at that time. | TLS validation, HTTP response and document access. |
| An HTTP refusal was observed for this request | An HTTP response for that request. | The exact refusal reason and other requests or users. |
Distinguish UDP from protocols built on it
HTTP/3 uses QUIC, which runs over UDP. Therefore, not all HTTPS traffic uses TCP/443. UDP’s own limited guarantees do not mean a higher protocol adds no mechanisms.
The transport name alone does not determine performance or application success. Those require relevant measurements and identification of the protocol actually used. These figures contain no measured speed, reachability or safety status.
Choose an explanation supported by each case
Choose an option to see the result and explanation.
Check, then explain in your own words
- Read the target address, transport and port.
- Use AB/CD to explain write and read boundaries.
- Separate evidence for one attempt from unverified application outcomes.
Check your understanding: What must be separated before saying “it connected”?
Separate the intended endpoint, observed TCP establishment for one attempt, and TLS/HTTP/application outcomes.
Neither a familiar port nor a configured target proves application success. Explain stream/datagram behavior and restrict observations to the peer and conditions actually supplied.
Sources and conditions checked
Primary references are collected here with their scope, conditions and corresponding sections. Independent expert review and live-environment validation have not been performed.
Scope and conditionsSections 2.2, 3.3.2, 3.7, 3.9.1: stream, listening and functional interfaces; no OS recipe or complete updates/errata audit.
Used in this lessonRead the address, transport and port together Compare a TCP stream with UDP datagrams Listening differs from establishment and application response
- RFC 768 — User Datagram ProtocolChecked:
Scope and conditionsIntroduction, Format and User Interface; delivery/duplicate-protection limits, considered with update RFC9868.
Used in this lessonRead the address, transport and port together Compare a TCP stream with UDP datagrams
Scope and conditionsSections 19 and 21: UDP-option surplus area and API extension; no universal delivery guarantee is inferred.
Used in this lessonCompare a TCP stream with UDP datagrams
- RFC 9114 — HTTP/3Checked:
Scope and conditionsAbstract and 3.1/3.2: HTTP/3 over QUIC and UDP connectivity; no live traffic validation.
Used in this lessonDistinguish UDP from protocols built on it
- RFC 9000 — QUICChecked:
Scope and conditionsAbstract: UDP-based transport; whole QUIC functionality and implementation conformance are outside this lesson.
Used in this lessonDistinguish UDP from protocols built on it
Scope and conditionsRegistry Note: registration does not certify actual applications or benign traffic; no specific 443 assignment or observed traffic validation.
Used in this lessonRead the address, transport and port together
Scope and conditionsSections 3/4: documentation blocks, including 192.0.2.0/24; not live targets or local configuration.
Used in this lessonRead the address, transport and port together
- RFC 6761 — Example domainsChecked:
Scope and conditionsSection 6.5: reserved example names; APIs may resolve them normally, so this lesson initiates no lookup.
Used in this lessonRead the address, transport and port together
- RFC 9110 — HTTP SemanticsChecked:
Scope and conditionsSections 1.1 and 3.7: application request/response and intermediaries; the document-access boundary is an editorial inference.
Used in this lessonListening differs from establishment and application response