TCP vs UDP

This page on TCP vs UDP describes difference between TCP and UDP. Both protocols sit on layer-4(Transport layer) of the OSI layer just above the IP layer.


Unlike TCP,UDP is connectionless and provides no reliability, no windowing and no funtion to ensure data is received in the same order as it was transmitted. However UDP provides some functionalities as supported by UDP such as data transfer,multiplexing and has fewer bytes of overhead in the data. This fewer bytes in the overhead makes UDP protocol need less time in processing the packet and need less memory. Also absence of acknowledgement field makes it faster as it need not have to wait on ACK or need not have to hold data in memory until they are ACKed.

TCP UDP
Defined in RFC793 Defined in RFC768
Full form is Transmission Control Protocol Full form is User Datagram Protocol
It establishes connected oriented service It establishes connectionless service
It is reliable in-order byte-stream protocol. It is unreliable un-ordered packet protocol.
Considered as most reliable connection due to presence of SYNC and acknowledgement fields Considered as unreliable service
protocol field for TCP module is 0x06 (decimal-6),present in IP header protocol field for UDP module is 0x11 (decimal-17),present in IP header
TCP header consists of source port,destination port,sequence number,Acknowledgement number, header length,flags(U,A,P,R,S,F),window,checksum,pointer and few padding bits.
TCP Header
UDP header consists of source port,destination port,segment length,checksum
UDP Header
(Data Transfer:)This involves continuous stream of ordered data, which are fed from upper layer and segmented before transmission This involves message for datagram delivery.
(Multiplexing:) Receiving hosts decide the correct application for which the data is destined, based on port number field(2bytes) Receiving hosts decide the correct application for which the data is destined, based on port number field(2bytes)
(Flow control:) uses window size to protect buffer space and routing devices This is not supported in UDP

Networking RELATED LINKS



What is Difference between

RF and Wireless Terminologies