What is Graphical User Interface? Detail Explained
What is Graphical User Interface? A graphical user interface (GUI) is a type of user interface that allows…

TCP (Transmission Control Protocol) and UDP (User Datagram Protocol) are the two main protocols operating at Layer 4 (Transport layer) of the OSI model. Both deliver data between applications using port numbers, but they do it in fundamentally different ways. TCP is connection-oriented and reliable — it guarantees delivery. UDP is connectionless and fast — it sends data without confirmation.
| Feature | TCP | UDP |
|---|---|---|
| Connection type | Connection-oriented (3-way handshake) | Connectionless |
| Reliability | Guaranteed delivery | No guarantee |
| Ordering | Ordered delivery (sequence numbers) | No ordering |
| Error checking | Yes — checksum + retransmission | Checksum only, no retransmission |
| Flow control | Yes (windowing) | No |
| Congestion control | Yes | No |
| Speed | Slower (overhead) | Faster (no overhead) |
| Header size | 20–60 bytes | 8 bytes |
| Use cases | Web, email, file transfer, SSH | DNS, VoIP, streaming, gaming, DHCP |
| OSI Layer | Layer 4 | Layer 4 |
Before TCP can send data, it establishes a connection using the 3-way handshake:
Data transfer begins after the handshake. When the session ends, TCP uses a 4-way FIN/ACK process to gracefully close the connection.
Every byte of data is assigned a sequence number, allowing the receiver to reorder segments that arrive out of order and request retransmission of missing ones.
The receiver sends ACK numbers confirming which bytes have been received. If the sender doesn’t receive an ACK within a timeout period, it retransmits the segment.
TCP uses a sliding window mechanism to control how much data can be sent before requiring an acknowledgment, preventing the sender from overwhelming the receiver.
TCP monitors network congestion and reduces transmission rate when congestion is detected (algorithms: slow start, congestion avoidance, fast retransmit, fast recovery).
UDP is dramatically simpler than TCP. It adds only port numbers, length, and a checksum to the data before sending. There is no connection establishment, no acknowledgment, no retransmission, and no ordering guarantee. This simplicity makes UDP extremely fast and lightweight — but at the cost of reliability.
Applications that use UDP either don’t need guaranteed delivery (DNS), can tolerate some loss (voice/video streaming), or implement their own reliability mechanisms at the application layer (QUIC protocol used by HTTP/3).
| Protocol | Transport | Port | Use |
|---|---|---|---|
| HTTP | TCP | 80 | Web browsing |
| HTTPS | TCP | 443 | Secure web browsing |
| FTP (data) | TCP | 20 | File transfer data |
| FTP (control) | TCP | 21 | File transfer control |
| SSH | TCP | 22 | Secure remote access |
| Telnet | TCP | 23 | Remote access (insecure) |
| SMTP | TCP | 25 | Email sending |
| DNS | UDP (TCP for zone transfers) | 53 | Domain name resolution |
| DHCP | UDP | 67/68 | IP address assignment |
| TFTP | UDP | 69 | Simple file transfer |
| SNMP | UDP | 161 | Network management |
| VoIP (RTP) | UDP | Varies | Voice over IP |
| NTP | UDP | 123 | Time synchronization |
| RDP | TCP | 3389 | Remote desktop |
QUIC (Quick UDP Internet Connections) is a modern transport protocol developed by Google, now standardized as the basis for HTTP/3. It runs over UDP but implements its own reliability, congestion control, and encryption at the application layer — combining the speed of UDP with reliability closer to TCP. QUIC significantly reduces connection setup time (0-RTT for returning connections) and handles connection migration (e.g., switching from WiFi to cellular).
Yes. UDP has significantly less overhead — no handshake, no acknowledgments, no flow control. For applications where speed matters more than reliability (live streaming, gaming, VoIP), UDP is the better choice.
Yes, at the application layer. QUIC is the best example — it uses UDP but implements reliability, ordering, and encryption in the application layer. Many modern protocols (DTLS, WebRTC) also add reliability on top of UDP.
Neither. Ping uses ICMP (Internet Control Message Protocol) which operates at Layer 3 (Network layer) and is not a Layer 4 protocol.
Neither is inherently more secure. Security is handled by encryption protocols (TLS/DTLS) that run on top of TCP or UDP. HTTPS uses TLS over TCP. DTLS provides TLS-equivalent security for UDP-based protocols.
Related: TCP Complete Guide | OSI Model Guide | IP Address Guide | Firewall Guide