TCP vs UDP
TCP
It is a connection-oriented protocol. It provides reliable, ordered, and error-checked delivery of a packet
Features
Ordered data transfer:
the destination host rearranges according to sequence number
Retransmission of lost packets
If the sender does not receive an ACK in a period of time, it transmits that packet again
Error-free data transfer
Use checksum to verify the segment is correct
Flow control
Situation: Faster Sender may block the slow receiver Limits the rate a sender transfers data to guarantee reliable delivery. The receiver continually hints the sender on how much data can be received controlled by the sliding window.
Congestion control
Situation: Faster sender may block the network Congestion Level:
- Received an ACK
- Received the same ACK three times
- Data lose
TCP vs UDP
TCP | UDP | |
---|---|---|
Connection | Connection-Oriented Protocol | Connectionless Protocol |
Speed of transfer | Slow | Fast (because error recovery is not attempted) |
Reliability | Retransmission and Ordered Data Transfer | No Guarantee |
Error Checking | Error Checking and Retransmission | Only Error Checking |
Usage | High Reliability; Transmission Time is Less Critical | Fast, Efficient Transmission; Data Loss is Tolerable |