In: Computer Science
Calculate TCP and UDP efficiency while sending data of size 200 bytes? Justify the difference between two.
Efficiency of UDP transmission
= number of bytes transferred ÷{no. of bytes transfer + length of the header}
UDP HEADER IS 8 Bytes in length
Data 200 bytes
efficiency= 200÷ {200+8}
efficiency = 200÷208
efficiency of UDP =0.961
efficiency % = 0.961×100
= 96.1%
efficiency of TCP can be calculated as with same formula with header size of 20 bytes.
efficiency % = (200÷ 220)×100
= 0.9090×100
= 90.9%
According to the above calculations UDP is more efficient i.e. 96.1% than TCP which is 90.9% efficient.
Difference between TCP and UDP.
1.TCP Means Transmission Control Protocol. Message transmit in the form of packets.
UDP Means User Datagram Protocol. Message transmit in the form of datagram.
2. TCP is connection oriented protocol.
UDP is connectionless protocol.
3. TCP is slow as medium is required at the sender and receivers end for transmission of packets containing data.
UDP is faster than TCP and data in which confidentiality is not necessary can be easily send via UDP.
4. The problem of congestion is less in TCP.
The problem of congestion is high in UDP.
5. TCP keeps track of lost packets and re tran smit them .
UDP does not keep track of any lost data or packet.
6. TCP is suitable for applications where high reliablity is required and transmission time is relatively less critical.
In contrast UDP is less reliable protocol with best effort delivery without acknowledgement.
7.In TCP small to huge amount of data can be transmitted.
In UDP small to moderate amount of data can be transmitted.
8. TCP read the data as a byte stream.
UDP send and read the data individually.
9. TCP doesn't support multicasting and broadcasting.
UDP supports broadcasting.
10. TCP header size is 20 bytes.
UDP header size is 8 bytes.
11.TCP Supports full duplex.
UDP doesn't support full duplex.
12. Programs that use TCP are : HTTP, FTP, HTTPS , MULTIPLAYER COMPUTER GAMES, Email.
Programs that use UDP are : Ip telephony, DNS,DHCP Music streaming.