Junior
What is special about TCP protocols?
sobes.tech AI
Answer from AI
TCP (Transmission Control Protocol) protocols:
- Reliability: Ensures guaranteed delivery of data. Packet losses are detected and retransmitted.
- Stream-oriented: Considers data as a continuous stream of bytes rather than a set of individual messages.
- Order of delivery: Guarantees that packets are delivered in the order they were sent.
- Flow control: Regulates the rate of data transmission to prevent overwhelming the receiving device.
- Congestion control: Adapts to network conditions to avoid congestion.
- Connection establishment (three-way handshake): A logical connection is established before data transfer between sender and receiver.
// Example of establishing a TCP connection (simplified)
// Client sends SYN
// Server responds with SYN-ACK
// Client responds with ACK
- Connection termination (four-way handshake): The connection is properly closed.
- Full-duplex communication: Data can be transmitted in both directions simultaneously.
Comparison table with UDP (User Datagram Protocol):
| Characteristic | TCP | UDP |
|---|---|---|
| Reliability | Guaranteed delivery | Not guaranteed |
| Order | Guaranteed order | Not guaranteed |
| Flow control | Present | Not present |
| Congestion control | Present | Not present |
| Connection-oriented | Yes | No |
| Headers | Larger overhead | Smaller overhead |
| Speed | Slower (due to reliability) | Faster (no control) |
| Applications | HTTP, FTP, SSH, Email | DNS, DHCP, VoIP (some) |