What is the difference between TCP & UDP protocols of TCP/IP protocol suite.
The 2 types of traffic in the network are based on TCP (Transmission Control Protocol) and UDP (User Datagram Protocol). Following are the differences between the two
- TCP is connection Oriented protocol, hence a connection need to be established (using 3-way handshaking) before data is transmitted using TCP. UDP is Connectionless protocol and no connection need to be established. The packets are sent directly over the network.
- Because connection need to be established, TCP data transfer takes more time (3-way handshaking is done for establishing connection and then for removing the connection) than data transferred using UDP.
- Connection in the TCP is established to make the transfer reliable (acknowledgement based). Hence data transfer using TCP is reliable and UDP is non-reliable (sender does no know, for sure, if the packet has actually reached the receiver or not).
- Header Size of a TCP packet is bigger than the UDP header.
- TCP does the error checking also, UDP does not have an option for Error checking.
- Packets are ordered in case of TCP (i.e they are received in the same order as they are sent).
- Application layer protocols like HTTP, FTP, Telnet, etc. uses TCP to transmit data where as UDP is used by protocols like VoIP, DHCP, SNMP, etc.