Transmission Control Protocol (TCP)
Transmission Control Protocol (TCP)
Transmission Control Protocol (TCP) is a connection-oriented protocol that ensures reliable and ordered delivery of data between devices on a network.
TCP operates at the transport layer of the TCP/IP model, providing end-to-end communication services for applications.
Key Features of TCP
- Connection Establishment: TCP uses a three-way handshake to establish a connection between the sender and receiver.
- SYN: The sender sends a synchronization request.
- SYN-ACK: The receiver acknowledges the request and sends its own synchronization request.
- ACK: The sender acknowledges the receiver's request, establishing the connection.
- Reliable Data Transfer: TCP ensures that all data packets are delivered accurately and in the correct order.
- Acknowledgments: The receiver sends an acknowledgment for each packet received.
- Retransmission: If a packet is lost or corrupted, the sender retransmits it.
- Flow Control: TCP uses a sliding window mechanism to prevent network congestion by controlling the rate of data transmission.
- Connection Termination: TCP gracefully closes connections using a four-way handshake (FIN, ACK, FIN, ACK).
- When implementing TCP in applications, consider its overhead.
- While TCP ensures reliability, it may introduce latency due to its connection setup and error-checking mechanisms.
User Datagram Protocol (UDP)
User Datagram Protocol (UDP)
User Datagram Protocol (UDP) is a connectionless protocol that provides faster but less reliable data transmission compared to TCP.
UDP operates at the transport layer and is ideal for applications where speed is prioritized over reliability.
Key Features of UDP
- Connectionless Communication: UDP does not establish a connection before sending data, reducing overhead and latency.
- No Error Checking: Unlike TCP, UDP does not provide error checking or retransmission, making it faster but less reliable.
- Use Cases: UDP is commonly used in:
- Real-time applications: Video streaming, online gaming, and VoIP.
- Multicasting: Sending data to multiple recipients simultaneously.
- Students often assume UDP is always faster than TCP.
- While UDP has lower overhead, its lack of error correction can lead to data loss, which may require additional handling at the application level.
Hypertext Transfer Protocol (HTTP)
Hypertext Transfer Protocol (HTTP)
Hypertext Transfer Protocol (HTTP) is the foundational protocol for data communication on the World Wide Web.
HTTP operates at the application layer and follows a request-response model.
Key Features of HTTP
- Stateless Protocol: Each HTTP request is independent, meaning the server does not retain information about previous requests.