In: Computer Science
What is UDP and how does it work? What are the differences between TCP and UDP?. Provide examples (if applicable) to support your comparative review.
Ans:- UDP stands for User Datagram Protocol. UDP is a connectionless protocol used to transfer data or messages between two computer systems. It transfers the data in the from of packets to the reciever, without maintaing any order of it. It can be used when user want to send messages without caring much about it's quality and reliability. It works under Transport layer in OSI model. UDP packets are also known as user datagrams. UDP is compartively fast in comparison to other protocols such as TCP, SCTP, but, it compromises the quality of message.
Differences between TCP and UDP:-
TCP | UDP |
TCP stands for Transmission Control Protocol. | UDP stands for User Datagram Protocol. |
TCP is a connection-oriented protocol. It requires to establish a connection before transmitting any data. | TCP is a connection less protocol. It does not require to open or maintain a connection before transmitting any data. |
It is slow in speed in comparison to UDP. | It is comparatively fast. |
It is more reliable(maintains order of the data transferred). | It is less reliable(does not maintain any order of the data tranferred). |
It is heavy-weight. | It is low-weight. |
It provides data flow control. | It does not provide any data flow control |
TCP provides mechanism of error checking, If error occur in any packet then it will be retransmitted. | UDP does error checking. But it does not support retransmittion of an errorneous packet |
Header size of TCP is 20 bytes. | Header size of UDP is 8 bytes. |
Protocol such as HTTP, HTTPS, TELNET, etc., uses TCP. | Protocol such as DNS, SNMP,VoIP,RIP, etc., uses UDP. |
Media Streaming, VoIP are some examples of UDP which focus more on speed rather than quality whereas SMTP, Web, Telnet, etc., are some examples of TCP which focus more on quality rather than speed.