Skip to content

TCP vs UDP

TCP vs UDP

Before the creation of networking applications, we must first understand some basic concepts of networking. TCP and UDP are some of the important concepts of networking. Let’s take a brief look at TCP vs UDP.

TCP

TCP (Transmission Control Protocol) / IP (Internet Protocol) is a standard protocol suite used on any network, including the Internet, which defines rules governing the transmission of data over the network. A protocol represents a set of rules to be followed by every computer on a network and thereby helps in moving data from one node to another over the network. TCP/IP suite consists of the following five layers:

  • Application layer
  • TCP (Transport layer)
  • IP (Network layer)
  • Data link layer
  • Physical layer

The application layer is the topmost layer of the TCP/IP suite that directly interacts with the user. This layer receives data from the application and formats of the data. It then sends that data to the next layer called TCP in the form of a continuous stream of bytes. The TCP, upon receiving the data from the Application layer, will divide it into small segments called ‘TCP segments’. A segment contains a group of bytes of data. These segments are then sent to the next IP layer which then puts them within the envelopes called ‘datagrams’. Each datagram contains a TCP segment, the IP address of destination computer, the IP address of source computer, and some additional bits useful in error detection and correction. The datagrams (or IP packets) from the IP layer are delivered to the Data Link layer which delivers the packet (in the form of the frame) to the physical layer for transmission to reach to correct destination. The last layer, which is called the Physical layer, is used to or physically transmit data on the network using the appropriate hardware. Below figure shows the creation of a packet and frame in the TCP/IP suite layers:

Creating a Packet and Frame in the TCP IP Layers

For sending data from one computer to another, first of all, the computers should be correctly identified on the network. This is done with the help of IP addresses. An IP address is a unique identification number assigned to every computer over a network. It contains four integer numbers in the range of 0 to 255 and separated by a dot, such as 67.195.160.76 which may represent a website as www.yahoo.com on a server machine over the Internet. As the IP address is difficult to remember, so the address is mapped to the easy-to-remember site name such as ‘www.google.com’, enabling a user to type the site name at the browser’s address bar for accessing a website. This mapping service is available over the Internet and is called Domain Name Service (DNS). On the Internet, IP addresses of 4 bytes are usually used and this version is called IP address version 4. The next new version of the IP address is version 6, which uses 16 bytes to identify a computer.

TCP/IP suite keeps a record of the number of bits delivered and also ensures that the destination computer has received all the bits correctly. Therefore the TCP/IP suite can be considered as a connection-oriented reliable protocol suite. Almost all the protocols on Internet use the TCP/IP model internally.

Few examples of the widely used protocols on the Internet are HyperText Transfer Protocol (HTTP), File Transfer Protocol (FTP), Simple Mail Transfer Protocol (SMTP), and Post Office Protocol (POP). HTTP is the most widely used protocol (.html, .XML, .jsp, and .asp files) from one computer to another computer on the Internet. FTP is useful to download or upload files from and to the server. SMTP is useful to send emails on the network. POP is useful to receive mails into the mailboxes.

Let’s discuss the User Datagram Protocol (UDP).

UDP

UDP protocol that transfers data during a connectionless and unreliable manner on a network. It doesn’t maintain a record of the no. of bits delivered or received on the network and during transmission of knowledge some bits could also be lost. As it does not provide connection-oriented service, it is faster and therefore, UDP is mostly utilized to transfer images, audio, and video files over a network in many applications. If some bits are lost during the transfer of images, audio, or video files over a network, the new image, audio, or video file can be created with negligible minor variation. UDP is also used in query-response type applications. One of the known applications using UDP is DNS to resolve the names to IP addresses.

Learn more about OSI Model in networking.

nv-author-image

Era Innovator

Era Innovator is a growing Technical Information Provider and a Web and App development company in India that offers clients ceaseless experience. Here you can find all the latest Tech related content which will help you in your daily needs.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.