TCP aur UDP mein kya farq hai aur inka comparison table kya hai?
Answered by Hamza Tariq
TCP (Transmission Control Protocol) aur UDP (User Datagram Protocol) dono Transport Layer ke main protocols hain. Simple lafzon mein, TCP reliability par focus karta hai jabke UDP speed par.
Dono ka comparison neechay table mein diya gaya hai:
| Feature | TCP (Transmission Control Protocol) | UDP (User Datagram Protocol) |
|---|---|---|
| **Connection Type** | Connection-oriented (3-way handshake lazmi hai) | Connectionless (baghair connection banaye data bhejta hai) |
| **Reliability** | High (data loss hone par retransmission hoti hai) | Low (best-effort delivery, data drop ho sakta hai) |
| **Speed** | Slower (acknowledgments aur overhead ki wajah se) | Much faster (minimal delay aur overhead) |
| **Data Ordering** | Packets hamesha sahi sequence/order mein pohanchte hain | Packets out of order bhi pohanch sakte hain |
| **Header Size** | 20 to 60 bytes (heavyweight) | 8 bytes fixed (lightweight) |
| **Error Handling** | Extensive error checking aur recovery mechanism | Basic error checking (checksum), koi recovery nahi |
| **Common Uses** | Web browsing (HTTP/HTTPS), File transfer (FTP), Email (SMTP) | Online gaming, Live video streaming, VoIP calls, DNS |
**Mental Model:**
* **TCP ek phone call ki tarah hai:** Pehle dono sides connect hoti hain ("Hello, sun rahe ho?"), phir baat cheet hoti hai, aur koi lafz miss ho jaye toh repeat karwaya jata hai.
* **UDP ek loudspeaker announcement ya post card ki tarah hai:** Message bhej diya gaya, ab sunne wale ne poora suna ya nahi, sender ko uski confirmation nahi milti—lekin message foran deliver hota hai.