TCP and UDP Protocols

tcp and udp

Read Time4 Minute, 1 Second

Basically the internet has two protocols in the transport layer of the OSI reference model. One of them is connection-oriented and the other one is a connectionless service. They are called TCP and UDP protocols.

TCP (Transmission Control Protocol) provides the service with connection and UDP (User Datagram Protocol) provides connectionless services to the user. UDP is basically just IP with an additional short header.

Now, we will see these two protocols in brief. First, let us see UDP.

TCP and UDP Protocols

UDP (User Datagram Protocol):

The User Datagram Protocol is a very simple, unreliable and connectionless protocol. It adds little to the basic functionality of IP.

While using UDP we don’t need to establish a connection with the host before sending or exchanging data. And there is no mechanism for ensuring the data you sent is received. This means that the arrival of the packet is not guaranteed, nor is the correct sequencing of delivered packets.

A unit of data sent using UDP is called Datagram. UDP adds a four 16-bit header field to the whatever data you sent.

The various fields of UDP header are: a length field, a checksum field, source port number and destination port number. The main thing here is that the “Port Number ” here represents a software port, not a hardware port.

UDP uses the port number to determine which application-layer protocol should receive the data.

Even though UDP is not a reliable protocol, but it is a preferred choice for many applications. It is used in much real-time applications that do not require acknowledgement of receipt of data, like audio and video where, if data is lost during transmission, it’s better to do without it than send it again out of sequence.

Basically the UDP header is divided into the following four 16-bit fields:

            1. Source Port                             3. Total Length

            2. Destination Port                    4. Checksum

  • The following are the applications of UDP,
  1.  UDP is used for RIP(Routing Information Protocol).
  2. UDP is used for management process such as SNMP.
  3. UDP is suitable for the multitasking application.
  4. UDP is suitable for the process of having inbuilt flow and error control mechanism, such as TFTP.
tcp and udp
a trending meme on social media

TCP (Transmission Control Protocol):

The TCP provides reliable transmission of data in an IP environment. TCP corresponds to the transport layer(Layer 4)  of the OSI reference model.

Among the services which TCP provides are stream data transfer, reliability, efficient flow control, full-duplex operation and multiplexing.

In this protocol to make the transfer service reliable, TCP host must establish a connection-oriented session with the another. Connection establishment is performed by using a three-way-handshake mechanism

With stream data transfer, TCP delivers an unstructured stream of bytes identified by sequence numbers.

TCP offers reliability by providing connection-oriented, end-to-end reliable packet delivery through an internetwork.

The reliability mechanism of TCP allows devices to deal with lost, delayed, duplicate, or misread packets. A time-out mechanism allows devices to detect lost packets and request for the retransmission of lost data.

TCP offers efficient flow control, which means that, when sending acknowledgements back to the source, the receiving TCP process indicates the highest sequence number that it can receive without overflowing its internal buffers.

TCP supports full-duplex operation means that TCP processes can both send and receive at the same time.

The relationship between TCP and IP is very interesting. Each TCP message gets encapsulated or inserted in an IP datagram and then this datagram is sent over the Internet to the destination.

In short, we can say that TCP protocol deals with the actual data transferring and IP takes care of the transfer of that data.

Many applications such as FTP, Remote login, TELNET etc. keep sending data to TCP software on the sending computer. 

The various features of TCP are,

  1. TCP is process-to-process protocol.
  2. TCP uses a port number like UDP.
  3. It is a connection-oriented protocol(creates a virtual connection).
  4. It uses flow and error control mechanisms.
  5. TCP is a reliable protocol.

TCP is a full-featured protocol that allows applications to send data reliably without worrying about network layer issues. The transmission speed of TCP is high, but not as UDP.

Applications of TCP are FTP, Telnet, SMTP, DNS, HTTP, POP, NNTP, IMAP, BGP, IRC, NFS etc.

These are the TCP and UDP protocols and their working along with the applications.

Read more in Networking

Author Payal Verma is a Network Admin.