askvity

Is TCP Connectionless?

Published in Networking Protocols 2 mins read

No, TCP is not connectionless. It is a connection-oriented protocol.

Here's a breakdown of what that means:

  • Connection-Oriented Protocol: TCP requires a dedicated connection to be established between two devices before data can be transferred. This connection is maintained throughout the communication and is terminated once the exchange is complete. Think of it like making a phone call - you dial, someone answers, you talk, and then you hang up.

  • Three-Way Handshake: TCP uses a three-way handshake to establish a connection. This process involves the exchange of SYN (synchronize), SYN-ACK (synchronize-acknowledge), and ACK (acknowledge) packets between the client and server. This ensures that both parties are ready to communicate.

  • Reliable Data Transfer: A core feature of TCP is its reliability. It guarantees that data is delivered in the correct order and without errors. This is achieved through mechanisms like sequence numbers, acknowledgments, and retransmission timers.

  • Example: When you browse a website, your computer uses TCP to connect to the web server. The three-way handshake establishes the connection. The website data is then sent over this connection, and TCP ensures that all the data is received correctly. When you're done, the connection is closed.

In contrast to TCP, UDP (User Datagram Protocol) is a connectionless protocol. UDP does not establish a connection before sending data; it simply sends packets to the destination. This makes UDP faster but less reliable than TCP.

Feature TCP (Connection-Oriented) UDP (Connectionless)
Connection Required Not Required
Reliability Reliable Unreliable
Data Delivery Ordered, Error-checked Unordered, No Error-checking
Overhead Higher Lower
Use Cases Web browsing, Email Streaming, Online Games

Related Articles