# Overview #flashcard Stateful protocol that is connection-oriented, which means the server must be “listening” for connection requests from clients. Used when accuracy is more important than speed of delivery. <!--ID: 1752427993556--> # Key Considerations ## TCP Handshake To establish a TCP connection, the client initiates a 3-way handshake with the server. ![[Transmission Control Protocol (TCP) 2024-12-06 10.17.32.excalidraw.svg]] %%[[Transmission Control Protocol (TCP) 2024-12-06 10.17.32.excalidraw|🖋 Edit in Excalidraw]]%% - **SYN**: The client sends a SYN (synchronize) packet to the server to request a connection. - **SYN-ACK**: The server responds with a SYN-ACK (synchronize-acknowledge) packet to acknowledge the request. - **ACK**: The client sends an ACK (acknowledge) packet to establish the connection. ## TCP Teardown After the data transfer complete, the connection is terminated: ![[Transmission Control Protocol (TCP) 2024-12-06 10.25.20.excalidraw.svg]] %%[[Transmission Control Protocol (TCP) 2024-12-06 10.25.20.excalidraw|🖋 Edit in Excalidraw]]%% # Pros of TCP #flashcard - TCP can perform flow control, or [[Backpressure]] to help ease overloading the receiving node - Also allows congestion control to help prevent overloading the network - TCP is able to retry transparently and considers a packet to be lost if it is not acknowledged within some timeout that is calculated from observed roundtrip times <!--ID: 1751507777110--> # Cons of TCP #flashcard - Higher latency compared to [[User Datagram Protocol (UDP)]] - Once the connection is established, it ensures that the data is delivered correctly and in order. This is a great guarantee to have but it also means that TCP connections take time to establish, resources to maintain, and bandwidth to use. <!--ID: 1751507777112--> # Use Cases # Related Topics