16 Difference Between TCP And UDP

SHARE

What Is Transmission Control Protocol (TCP)?

Transmission Control Protocol (TCP) is a connection-oriented protocol that computers use to communicate over the internet. It is one of the main protocols in TCP/IP networks. TCP provides error-checking and guarantees delivery of data and that packets will be delivered in the order they were sent.

TCP determines how to break application data into packets that networks can deliver sends packets to and accepts packets from the network layer, manages flow control and because it is meant to provide error-free data transmission, handles retransmission of dropped or garbled packets and acknowledges all packets that arrive.  

TCP is used for organizing data in a way that ensures the secure transmission between the server and client. It guarantees the integrity of data sent over the network, regardless of amount. For this reason, it is used to transmit data from other higher-level protocols that require all transmitted data to arrive.

The various kinds of protocols used by TCP for data transmission include:

  • HTTP (hypertext transfer protocol)
  • HTTPS (hypertext transfer protocol secure)
  • FTP (File transfer protocol)
  • SMTP (Simple mail transfer protocol) etc.

What You Need To Know About TCP

  • TCP is a connection-oriented protocol, which means that the connection needs to be established before the data is transmitted over the network.
  • TCP reads data as streams of bytes and the message is transmitted to segmented boundaries.
  • TCP is heavy-weight. TCP requires three packets to set up a socket connection before any user data can be sent.
  • TCP is suitable for applications that require high reliability and transmission time is relatively less critical.
  • Erroneous segments are retransmitted from the sender to the receiver.
  • In TCP, the data is transmitted in a particular sequence, which means that packets arrives in-order at the receiver.
  • TCP has a (20-80) bytes variable length header.
  • TCP offers extensive error checking mechanisms because it provides flow control and acknowledgement of data.
  • TCP is a reliable protocol as it provides assurance for the delivery of data packets.
  • TCP has Congestion-control mechanism that regulates the transport-layer sender when one or more links between the source and destination hosts become excessively congested.
  • The various kinds of protocols used by TCP for data transmission are HTTP (hypertext transfer protocol), HTTPS (hypertext transfer protocol secure), FTP (File transfer protocol) and SMTP (Simple mail transfer protocol) etc.
  • TCP is slower than UDP as it performs error checking, flow control and provides assurance for the delivery.
  • A TCP connection is established through a three way handshake which is a process of initiating and acknowledging a connection.  Once the connection is established data transfer can be begin. After transmission, the connection is terminated by closing of all established virtual circuits. TCP uses handshake protocol like SYN, SYN-ACK, ACK.
  • There are acknowledgement segments in TCP.
  • TCP is used mainly where a secure and reliable communication process is required like military services, web browsing and e-mail.
  • TCP does not support broadcasting.

What Is User Datagram Protocol (UDP)?

User Datagram Protocol (UDP) is a communication protocol that facilitates the exchange of messages between computing devices in a network. UDP is a connectionless protocol and works just like TCP but assumes that error-checking and recovery services are not required. Instead, UDP continuously sends packets to the recipient whether they receive them or not. In a network that uses the Internet Protocol (IP), it is sometimes referred to as UDP/IP.

UDP divides messages into packets, referred to as Datagrams, which can then be forwarded by the devices in the network- switches, routers, security gateways- to the destination application/server. While UDP does not number or reassemble the datagrams, it does include port numbers in the datagram header that help distinguish different user requests and an optional checksum capability that can help verify the integrity of the data transferred.

UDP speeds up transmission by enabling the transfer of data before an agreement is provided by the receiving party. As a result, UDP is beneficial in time-sensitive communications. The various kinds of protocols used by UDP for data transmission are:

  • BOOTP (Bootstrap protocol)
  • Voice Over Internet Protocol (VoIP)
  • DHP (dynamic host configuration protocol)
  • DNS (Domain name server)
  • TFTP (Trivial file transfer protocol) etc.

What You Need To Know About UDP

  • UDP is a connectionless protocol which means that it sends the data without checking whether the system is ready to receive or not.
  • UDP messages contain packets that were sent one by one. It also checks for integrity at the arrival time.
  • UDP is lightweight. There are no tracking connections, ordering of messages etc. It is a small transport layer designed on top of IP.
  • Suitable for applications that need fast, efficient transmission and reliability is less critical.
  • Erroneous segments are discarded. Error recovery is not attempted.   
  • There is no sequencing of data in UDP. All packets are independent of each other. If ordering is required, it has to be managed by the application layer.
  • UDP has a 8-bytes fixed length header.
  • UDP has just a single error checking mechanism which is used for checksums.
  • UDP is an unreliable protocol as it does not take the guarantee for the delivery of packets.
  • UDP does not have an option for flow control.
  • The various kinds of protocols used by UDP for data transmission are BOOTP (Bootstrap protocol), DHP (dynamic host configuration protocol), DNS (Domain name server) and TFTP (Trivial file transfer protocol) etc.
  • UDP is faster than TCP as there is no error checking and it does not guarantee the delivery of data packets.
  • UDP uses a simple transmission model without implicit hand-shaking dialogues for guaranteeing reliability, ordering or data integrity.
  • There are no acknowledgement segments in UDP.
  • UDP is mainly used where fast communication is required and does not care about the reliability like VoIP, game streaming, video and music streaming.
  • UDP supports broadcasting.

Also Read: Difference Between FTP And TFTP

Difference Between TCP And UDP In Tabular Form

BASIS OF COMPARISON TCP UDP
Description TCP is a connection-oriented protocol, which means that the connection needs to be established before the data is transmitted over the network.   UDP is a connectionless protocol which means that it sends the data without checking whether the system is ready to receive or not.  
Message TCP reads data as streams of bytes and the message is transmitted to segmented boundaries.   UDP messages contain packets that were sent one by one. It also checks for integrity at the arrival time.  
Nature TCP is heavy-weight.   UDP is lightweight
Suitability TCP is suitable for applications that require high reliability and transmission time is relatively less critical.   Suitable for applications that need fast, efficient transmission and reliability is less critical.  
Erroneous Segments Erroneous segments are retransmitted from the sender to the receiver.   Erroneous segments are discarded. Error recovery is not attempted.     
Sequencing Of Data In TCP, the data is transmitted in a particular sequence, which means that packets arrives in-order at the receiver.   There is no sequencing of data in UDP. All packets are independent of each other. If ordering is required, it has to be managed by the application layer.  
Length Header TCP has a (20-80) bytes variable length header.   UDP has a 8-bytes fixed length header.  
Error Checking Mechanism TCP offers extensive error checking mechanisms because it provides flow control and acknowledgement of data.   UDP has just a single error checking mechanism which is used for checksums.  
Reliability TCP is a reliable protocol as it provides assurance for the delivery of data packets.   UDP is an unreliable protocol as it does not take the guarantee for the delivery of packets.  
Flow Control TCP does have an option for flow control.   UDP does not have an option for flow control.  
Speed TCP is slower than UDP as it performs error checking, flow control and provides assurance for the delivery.   UDP is faster than TCP as there is no error checking and it does not guarantee the delivery of data packets.  
Hand-shaking Dialogue A TCP connection is established through a three way handshake which is a process of initiating and acknowledging a connection.   UDP uses a simple transmission model without implicit hand-shaking dialogues for guaranteeing reliability, ordering or data integrity.  
Acknowledgement Segments   There are acknowledgement segments in TCP.   There are no acknowledgement segments in UDP.  
Application TCP is used mainly where a secure and reliable communication process is required like military services, web browsing and e-mail.   UDP is mainly used where fast communication is required and does not care about the reliability like VoIP, game streaming, video and music streaming.  
Broadcasting TCP does not support broadcasting.   UDP supports broadcasting.