TCP and UDP
TCP and UDP are transport protocols that carry application data between programs on IP networks. TCP provides an ordered, reliable byte stream, while UDP sends separate messages with fewer built-in delivery services.
itNetworking | OpenSkills.info
Course pathWalk it in order
Look it upDip in anytime
Go furtherLeaves this page
Don't Panic
Don't Panic: TCP and UDP
TCP and UDP are the two traffic clerks standing above IP. IP can get a packet to the correct host, which is an impressive achievement until that host contains more than one program. The clerks use port numbers to point traffic at the right application endpoint. Same building, different desks, no interpretive dance required.
TCP is the clerk with a ledger. It establishes a connection, numbers the bytes, accepts acknowledgments, retransmits detected loss, and slows down for a receiver or a congested path. That is useful when every byte matters and arrives in sequence. The catch is that TCP is a byte stream, not a parcel service. Two application writes can emerge as one read, or as awkward fragments, so the application must label where its records begin and end.
UDP carries separate datagrams. Each delivered datagram keeps its boundary, and there is no transport handshake before sending. That makes it a fit when message boundaries matter or late data has less value than missing data. It also hands back several chores: delivery, ordering, duplicate handling, flow control, and congestion control do not disappear. They relocate into the protocol above UDP, where they become your problem with a much smaller hat.
A port is a delivery clue, not an identity card. TCP port eighty and UDP port eighty belong to separate transport namespaces. Neither transport tells you what the application data means, whether a peer processed it, or whether that peer is authorized. Those answers live in the application protocol and its security design.
Start with the Intro when the connection, datagram, and endpoint vocabulary is new. Use Slides when the choice between stream and message needs a compact map. Keep the Cheatsheet nearby for port ranges, header fields, and capture filters. The practice reference then turns the model into localhost evidence, where TCP chunks bytes and UDP keeps the two messages separate.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://www.rfc-editor.org/rfc/rfc9293.html
Supports
- TCP as a reliable, in-order, bidirectional byte-stream service
- Connection identity, setup, sequence numbers, acknowledgments, retransmission, checksums, flow control, and connection states
- TCP port multiplexing and lack of preserved application message boundaries
- TCP acknowledgments describe transport receipt rather than application completion
- RFC 9293 publication as the current TCP specification
- https://www.rfc-editor.org/rfc/rfc768.html
Supports
- UDP datagram model and minimal transport service
- Source port, destination port, length, and checksum header fields
- UDP length and checksum behavior
- RFC 768 publication as the UDP specification
- https://www.rfc-editor.org/rfc/rfc1122.html
Supports
- UDP as non-guaranteed datagram delivery
- UDP application responsibility for reliability, reassembly, flow control, and congestion avoidance when required
- UDP support for multicast and broadcast delivery
- RFC 1122 publication as Internet host requirements
- https://www.rfc-editor.org/rfc/rfc8085.html
Supports
- Congestion-control requirements for applications and protocols using UDP
- UDP guidance for message sizes, reliability, checksums, middlebox traversal, and ports
- Need to handle loss, duplication, reordering, and delay above UDP
- RFC 8085 publication as UDP usage guidance
- https://www.rfc-editor.org/rfc/rfc8095.html
Supports
- Comparison of services provided by TCP and UDP
- UDP endpoints, message orientation, lack of flow control, and application-supplied transport features
- https://www.rfc-editor.org/rfc/rfc7605.html
Supports
- System, User, and Dynamic port ranges
- Separate transport-specific assignments and limits of port-based application identification
- https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml
Supports
- Current Service Name and Transport Protocol Port Number Registry
- Assigned service names and protocol-specific port records
- https://github.com/sindresorhus/awesome
Supports
- PCAPTools as the relevant curated list under Networking
- https://github.com/caesar0301/awesome-pcaptools
Supports
- Curated discovery of Wireshark, tcpdump, Scapy, and Ostinato
- Packet capture, inspection, construction, replay, and traffic-generation use cases
- https://www.wireshark.org/docs/wsug_html/
Supports
- Wireshark packet analysis, protocol field inspection, and TCP and UDP filtering
- Wireshark placement in the transport-observation landscape
- https://www.tcpdump.org/manpages/tcpdump.1.html
Supports
- tcpdump command-line packet capture and filter expressions
- tcpdump placement in the transport-observation landscape
- https://scapy.readthedocs.io/en/latest/
Supports
- Scapy packet construction, sending, capture, decoding, and interactive use
- https://ostinato.org/docs/
Supports
- Ostinato packet crafting, editing, replay, traffic generation, graphical interface, and API
- Ostinato placement in the transport-observation landscape
- https://www.rfc-editor.org/rfc/rfc675.html
Supports
- RFC 675 publication and early Internet TCP connection, acknowledgment, window, and retransmission design
- https://www.rfc-editor.org/rfc/rfc761.html
Supports
- RFC 761 publication as a DoD TCP standard
- https://www.rfc-editor.org/rfc/rfc793.html
Supports
- RFC 793 publication and TCP byte-stream, connection, sequencing, acknowledgment, and control behavior
- https://www.rfc-editor.org/rfc/rfc1323.html
Supports
- RFC 1323 window scaling, timestamps, and protection against wrapped sequence numbers
- https://www.rfc-editor.org/rfc/rfc5681.html
Supports
- RFC 5681 slow start, congestion avoidance, fast retransmit, and fast recovery
- https://www.rfc-editor.org/rfc/rfc7413.html
Supports
- RFC 7413 TCP Fast Open and data exchange during a cookie-bearing handshake
- https://nmap.org/book/port-scanning-options.html
Supports
- Nmap TCP and UDP scan selection and transport-specific port probing
- https://software.es.net/iperf/invoking.html
Supports
- iPerf3 TCP and UDP test modes and its TCP control connection
- https://docs.python.org/3/library/socket.html
Supports
- Python socket APIs used by the localhost TCP and UDP exercise
- https://blog.cloudflare.com/head-start-with-quic/
Supports
- TCP multiplexing head-of-line blocking and QUIC stream independence
