>[!quote] In a Nutshell >Core **Transport Layer** protocol of the **[[Internet Protocol Suite (TCP-IP)|Internet Protocol Suite]]**. TCP is a **connection-oriented** protocol, meaning it establishes a reliable connection between the sender and receiver before data is exchanged. --- ![[Pasted image 20250417155316.png]] --- #### UDP vs. TCP | **Feature** | **TCP (Transmission Control Protocol)** | **[[UDP - User Datagram Protocol\|UDP (User Datagram Protocol)]]** | | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Connection Type** | Connection-oriented (requires handshake) | Connectionless (no handshake required) | | **Reliability** | Reliable: ensures message acknowledgment, retransmission, and timeouts. Lost data is re-sent. | Unreliable: no acknowledgment, retransmission, or timeouts. Data may be lost. | | **Message Ordering** | Ordered: guarantees messages are delivered in the order they were sent. | Not ordered: messages may arrive in any order. | | **Protocol Overhead** | Heavyweight: requires 3-way handshake for connection setup, handles reliability and congestion control. | Lightweight: no connection setup, no reliability or congestion control. | | **Data Transmission** | Streaming: data is transmitted as a byte stream without boundaries for individual messages. | Datagrams: each packet has definite boundaries; messages are distinct. | | **Congestion Control** | Built-in congestion control mechanisms to avoid network overload. | No built-in congestion control; must be implemented at the [[Internet Protocol Suite (TCP-IP)\|application level.]] | | **Broadcast** | No support. | Supports broadcasting: [[IP Packets\|packets]] can be sent to all devices on a [[IP Address, IPv4, IPv6, ULA and Subnet Mask\|subnet]]. | | **Multicast** | No support. | Supports multicast: a single packet can be delivered to multiple receivers. | | **Data Integrity** | Guarantees data integrity and retransmission in case of errors. | No integrity guarantees; the application must handle error recovery if needed. | | **Use Case** | Suitable for applications where reliability, ordering, and connection setup are crucial (e.g., [[HTTP and HTTPS - Hypertext Transfer Protocol\|HTTP]], FTP, etc.). | Suitable for applications where speed and low overhead are important, and some data loss is acceptable (e.g., streaming, gaming, [[DNS and DDNS - (Dynamic) Domain Name System\|DNS]], etc.). |