Network protocols are a set of rules that define how to transmit and receive data
#1. TCP
TCP prioritizes reliability over time.
- Connection-oriented
- Connection between client and server is established before data is sent
- This connection is established through a process called 3-way Handshake
- Reliable
- Lost packets are detected and retransmitted
- Sequence numbers
- This allows receivers to discard duplicate packets and properly sequence reordered packets
- Acknowledgements
- This allow senders to determine when to re-transmit lost packets
- Order
- All bytes received will be in the same order as those sent
- Checksums
- Ensures the data correctness
- Flow Control
- Limit the rate a sender transfers data to a receiver
- Congestion Control
- The rate of data entering the network is controlled
#2. UDP
UDP prioritizes time over reliability.
UDP is mostly used for video/audio live streaming or online games, where latency is a critical concern and we can afford losing packets occasionally
- No Connection
- No Reliability
- Does not support most of the feature TCP support
- No acknowledgements, no retransmission, no order, no flow control, no congestion control
- Checksums
- Ensures data correctness
- Broadcast
- A single message can be transferred to ALL recipients on the subnet simultaneously
- Multicast
- A single message can be routed only to intended recipients
#3. HTTP
- Request/Response protocol
- Client submits an HTTP request message to the server and the server sends back an HTTP response
- TCP
- Older HTTP protocol versions use TCP as an underlying transport protocol
- QUIC (New versions only)
- New(HTTP/3) HTTP protocol versions uses QUIC as an underlying transport protocol
- QUIC is built on top of UDP, but it provides a reliable connection
- Persistent Connection (New versions only)
- From old versions of HTTP, the connection is closed after a single request/response pair.
- This is not efficient, because creating a new connection for every request takes time and CPU utilization because of the TCP handshake process.
- From new versions of HTTP, connection is considered persistent. Which can be used more than one request.
- From old versions of HTTP, the connection is closed after a single request/response pair.
- Multiplexing (New versions only)
- Multiple requests are sent over the same TCP connection without waiting for responses.
- Responses are received in an arbitrary order.
- Compression
- Allows the content to be compressed on the server before transmission to the client
- Compression decreases transfer latency and increases throughput

Leave a comment