Today we are going be taking an investigative approach looking at the Transport Layer Protocols, TCP and UDP
Transmission Control Protocol
TCP is a connection-oriented protocol that establishes a logical connection between the source and destination devices (The three-way handshake) before data exchange between devices takes place.
The TCP protocol enables reliable data transmission by enabling error recovery, Flow control using windowing, connection establishment and termination, ordered data transfer and segmentation.
It would be advantageous to make use of TCP in scenarios such as file transfers using for example the ftp protocol or sending email via smtp.
User Datagram Protocol
UDP provides no error recover/reliability or any of the features found in TCP such as congestion or flow control, there is no connection formed between the sender and the receiver.
Since there is no connection formed and there is no error recovery and features among those lines, there is minimal overhead when compared to the TCP protocol.
The implementation of the UDP protocol takes place at services where some packet loss can be tolerated, and retransmission is not required.
Examples of where there UDP protocol is implemented instead of TCP would include IPTC, NTP, VoIP and RIP.
Summary
- TCP and UDP are both transport layer protocols. TCP is used for reliable connection-oriented communication in contrast to UDP which is used for connectionless communication.
- The TCP carries overhead in contrast to UDP
- TCP has error handling and checking in the form of Cyclic Redundancy Checks in direct contrast to UDP which has no error handling.
- TCP is used where no packet loss can be tolerated and UDP is used where packet loss can be tolerated.