The Difference between TCP and UDP Ports (with Comparison Tables)

In Computer Networking Skills, Computer Skills
The Difference between TCP and UDP Ports

Both TCP and UDP are protocols are packets that work to send data through the Internet. Whether you are transferring a packet over TCP or UDP port, that packet is delivered to an IP address. That packet is handled similarly. It’s because the packet is carried on from your computer to go-between routers. However, TCP and UDP work differently. So, here we are going to discover the difference between TCP and UDP ports.

Understanding TCP

Transmission Control Protocol (TCP) is a type of protocol that enables a number of computers to communicate and exchange data within a network. TCP is a protocol that resides in the transport layer (either in the seven layers of the OSI or DARPA reference model) that is connection-oriented and reliable. The function of TCP for applications that require data reliability.

The concept of TCP/IP (TCP over IP) begun with the need of US DoD (Departement of Defense) US for the communication between various types of computers. DoD computers often have to be in contact with many research organizations and must stay in touch. So, the country’s defenses continue to run during disasters, such as nuclear explosions. Therefore, in 1969, a research on a series of TCP/IP protocols was started. The objectives of the TCP/IP research are as follows:

  • To create common protocols, DoD requires a predefined protocol for all networks.
  • To improve data communication efficiency.
  • To be able to integrate with existing WAN (Wide Area Network) technology.
  • Easy to configure.

Characteristics of TCP

Reliable. It means the data that is transferred to its destination is in a sequence like when it was sent.
Connection-oriented. Before the data can be transmitted between two hosts, firstly, two processes that are running on the application layer must negotiate to establish a connection session. TCP connection is closed by using TCP connection termination process.

Full-duplex. For each TCP host, the connection between two hosts consists of two paths, the outbound path and the entry point. By using a lower layer technology that supports full duplex, ou can send and receive data simultaneously. The TCP header contains the sequence number (TCP sequence number) from the transmitted data and an acknowledgment of incoming data

Having a flow control service. It works to prevent too much data being sent at a time, which eventually “stops” the IP internetwork network. TCP implements a flow control service owned by the sender that continuously monitors and limits the amount of data transmitted at one time. In order to prevent the receiving party from obtaining data that can not be buffered, TCP also implements flow control in the receiving end. Indicating the number of buffers that are still available on the receiving end.

TCP port works to segment the data that is coming from the application layer (in the DARPA Reference Model). It also sends packages “one-to-one”. It is because TCP must create a logical circuit between the two application layer protocols to communicate with each other. TCP does not provide one-to-many data transmission services.

How TCP/IP Works

The following are the steps how TCP/IP works:

  • First, the datagram is divided into small sections and the corresponding to the bandwidth size (frequency width) in which the data will be sent.
  • In the TCP layer, the data is then “wrapped” with the required header information. For example, such as how to direct the data to its destination, how to re-assemble the pieces of data when it comes to its purpose, and so forth.
  • After the datagram is wrapped with a TCP header, the datagram is sent to the IP layer.
  • IP receives a datagram from TCP and adds its own header to the datagram.
  • Then, IP directs the datagram to its destination.
  • The receiving computer performs the calculation processes, it checks the same checksum calculation the same as the received data.
  • If the two calculations do not match, there will be an error while sending the data. Then, the datagram will be sent back.

The Advantages of Using TCP/IP

  • TCP/IP protocol is a protocol that can be directed. This means that this kind of protocol can send the datagram through predetermined routes. This thing can reduce the density of traffic on the network, and this can also help if the network fails, TCP/IP can direct data through other channels.
  • This protocol is a reliable and efficient in data transmission mechanism.
    It tends to be an open platform or an independent platform that is not bound by certain types of hardware or software.
  • Due to its open nature, TCP/IP can transmit data between different computer systems which are running on different operating systems.
  • TCP/IP is separate from the underlying hardware. This protocol can run on an Ethernet network, Token ring, X.25, and even over a telephone line.
    TCP/IP uses a common addressing scheme, so all systems can transmit data to other system addresses.

TCP Usability

  • Provides logic communication between running application processes on different hosts transport protocols run on end systems
  • File transfer. File Transfer Protocol (FTP) allows a user of a single computer to be able to send or receive files from and to a computer network. Due to data security issues, FTP often requires username and password.
  • Although, many FTP can also be accessed via anonymous (without using a password).
  • Remote Login. The Network Terminal Protocol (telnet) allows a computer to log into a computer within a network. This means that the user uses his or her computer as an extension of the networked computer.
  • Computer mail. As a function to implement electronic mail system.
    Network File System (NFS). Its remote files access service that allows clients to access files on remote network computers even if the files are stored locally.
  • Remote execution. This allows users to run a program on different computers. It’s usually useful if a user uses a computer with a limited capabilities, while the user requires a lot of resources in a computer system. There are several types of remote execution. There are only basic commands, which can be run in the same computer system. Some are using “remote call system procedure”, which allows the program to call the subroutine that will run on a different computer system. (for example, in Berkeley UNIX there are “rsh” and “rexec” commands)
  • Name servers. They are the name of the address databases which are used on the internet.

TCP Connection Management

  • At the time of setting up the connection, the client sends a TCP SYN control to the server, giving the initial sequence number. Then, the server accepts TCP SYN, and responds with an SYNACK control:
    The ACK acknowledge that has received an SYN.
    Allocating buffers.
  • Generate sequence numbers for the client.
  • At the time of closing connection, the client sends a TCP FIN control to the server. Then, the server receives FIN, and reply with ACK to close the connection and send the FIN to the client. The client receives FIN and reply to ACK. After that, waiting for an ACK reply to from the server. Finally, the server receives ACK and the connection is closed.

TCP Header

There are various sizes of the TCP headers. The smallest TCP header size (when there is no additional TCP option) is 20 bytes.

TCP Port

The TCP port is capable of indicating a particular location for delivering sent TCP segments, which is identified with the TCP Port Number. The numbers below 1024 are commonly used and defined by IANA (Internet Assigned Number Authority).

TCP ports are different to UDP ports, even though they have the same port numbers. Each of TCP ports represent one side of a TCP connection for application layer protocols, while UDP ports represent a UDP message queue for application layer protocol. In addition, the application layer protocol that use a TCP port and UDP port in the same number, no need to be the same. For example, an Extended Filename Server (EFS) protocol uses a TCP port number 520, and the Routing Information Protocol (RIP) uses an UDP port with number 520 too. Obviously, the two protocols are absolutely different! Therefore, to enter a set of port numbers, you need also to enter the type of the port it uses.

Some Applications That Use TCP Port

1. World Wide Web

Basically, World Wide Web is similar to the gopher application, i.e. the provision of a database that can be accessed not only in the form of text, but can be in the form of images, sounds, and videos. The present can be done live. Thus, each type of information that can be provided are numerous and can be made with a more appealing look. This is possible because the Web uses hypertext technology. Therefore, the protocol used for this kind of application is known as Hypertext Transfer Protocol (HTTP).

2. Archive

An FTP application allows you to transfer files from anywhere in the world. It means we know the location of the files we are looking for. But in case you don’t know where the location of a file you are looking for, you need an application to help you find where the location of the file is.

To fid out the work-flow of Archie, read the following explanation. The Archie server periodically performs anonymous FTP to a number of FTP Servers and retrieves the information of the entire file listings on the FTP Servers. The list is organized based on the location of the files in the directory or sub directory, making it easy to find the files. The files that contain the list of the files of each FTP Server are the databases of the Archie Server. If there is a query to the Archie Server that asks for a file, the server searches in the list and sends all of the answers which are relevant to the file. The given information is the FTP Server address that has the file and the location of the file in the directory structure.

3. Wide Area Information Services (WAIS)

WAIS is one of the services on the internet that allows us search through an indexed material and find documents or articles based on the contents of the article. So basically, WAIS provides a service to search for articles that contain the keywords that we propose as a search base.

WAIS applications are usually text-based. To make a document that can be searched through WAIS Server, firstly, you must create the index of the document. Each word in the document is sorted and counted. If there is a query from a client, the index will be checked and the result is the document with the given keywords. Since there may be many documents that have the words we propose, some of the documents with those keywords are score. Documents that contain the most keywords will get the highest score. Thus, the user gets the most likely information from several documents containing the set of the words he submits. This like how a search engine works and this is one of On-Page SEO factors that is used by SEO specialists by using keyword strategy.

4. Internet FAX

As the sender and receiver of written news through phones, today, almost all offices use FAX machine. Through the FAX Internet gateway, you can send FAX through e-mail. The Gateway will translate the e-mail message and will automatically contact the destination FAX machine via phone line. But the access to this kind of gateway is limited (private).

Understanding UDP

UDP stands for User Datagram Protocol, is one of the TCP/IP transport layer protocols that supports unreliable and unrelated communications between hosts in networks that are using TCP/IP.

Characteristics of UDP

  • Connectionless. It means UDP messages will be sent without having to negotiate the connection between the two hosts who want to exchange information.
  • Unreliable. The UDP messages will be sent as datagrams in the absence of sequential numbers or acknowledgment messages. The application layer protocol that is running on UDP must perform recovery of lost messages during the transmission process. Generally, the application layer protocols that are running on
  • UDP implements their respective reliability services, or send messages periodically or by using defined time.
  • UDP provides a mechanism for sending messages to an application layer protocol or a specific process within a host in a network that uses TCP/IP. HeaderUDP contains the Source Process Identification and Destination Process Identification fields.
  • UDP provides a 16-bit checksum count of overall UDP messages.

UDP Usability

  • Lightweight protocol. To save memory and processor resources, some application layer protocols require the use of lightweight protocols that can perform specific functions by exchanging messages. An example of a lightweight protocol is the name query function in the Domain Name System application layer protocol.
  • Application layer protocol that implements reliability services. If the application layer protocol provides a reliable data transfer service, then the need for reliability which is offered by TCP becomes non-existent. For examples Network File System (NFS) and Trivial File Transfer Protocol (TFTP).
  • UDP does not need reliability. For example, the Routing Information Protocol (RIP).
  • Broadcast transmission. Because UDP is a protocol that does not need to make connection with a particular host at the first, broadcast transmission is possible. An application layer protocol can send packets of data to multiple destinations using multicast or broadcast addresses. This is in contrast to the TCP protocol that can only transmit one-to-one transmission. Example: the name query in NetBIOS Name Service protocol.

The Disadvantages of UDP

  • UDP does not provide a buffering mechanism for incoming data or outgoing data. The buffering task is a task that should be implemented by the application layer protocols that are running on UDP.
  • UDP does not provide a large data segmentation mechanism into data segments, as happens in the TCP protocol. Therefore, application layer protocols which are running over UDP must transmit small data (no greater than the value of the Maximum Transfer Unit/MTU) which belongs to an interface in which the data is sent. Because, if the packet size of the transmitted data is greater than the MTU value, the sent packets data may be split into fragments that eventually do not get sent correctly.
  • UDP does not provide a flow-control mechanism.

UDP Header

The UDP header is manifested as a header with 4 fields with a fixed size.

UDP Port

Just like TCP, UDP also has channels for sending information between hosts. They are called as UDP Ports. To use the UDP protocol, an application must provide the IP address and UDP Port numbers of the target host. An UDP port acts as a multiplexed message queue, which means that the UDP port can receive multiple messages simultaneously. Each port is identified by a unique number, just like TCP, but even so, UDP Port is different from TCP Port even though it has the same port number.

Some Applications that Use UDP Port

UDP port is useful for multimedia streaming, which greatly tolerates segment loss very well and is highly insensitive to damage or loss of a segment.

Some examples of application protocols that use UDP Port:

  • DNS (Domain Name System), port 53
  • TFTP (Trivial File Transfer Protocol), port 69
  • SunRPC, port 111
  • SNMP, (Simple Network Management Protocol) 161, 16.

Read also: How to set up port forwarding.

The Difference between TCP and UDP Ports

  • Unlike TCP, UDP is connectionless and there is no reliability, windowing, and functionality to ensure whether or not data is delivered or received correctly. However, UDP also provides the same functionality as TCP, such as data transfer and multiplexing, but it works with fewer additional bytes in UDP header.
  • UDP does UDP multiplexing using the same way as TCP. The only difference is the used transport protocol, that is UDP. An app can open the same port number on a single host, but one uses TCP and the other uses UDP-it’s not unusual, but it’s allowed. If a service supports TCP and UDP, it uses the same value for the numbers of both TCP and UDP ports.
  • UDP has a advantage over TCP by not using the field sequence and acknowledgment. The most obvious advantage of UDP over TCP is the fewer additional bytes. In addition, UDP does not need to wait for reception or store data in memory until the data is received. This means, UDP applications are not slowed down by the receiving process, and the memory can be freed faster. In the table, you can see some functions which can be performed (or not performed) by UDP or TCP.

Table of the Difference between TCP and UDP Ports

Below is the first comparison table of the difference between TCP and UDP ports.

1Operates based on connection concept.Not based on the connection concept, so have to create your own code.
2The guarantee of sending-receiving data will be reliable and orderly.There is no guarantee that data transmission and reception will be reliable and orderly, so data packets may be less, duplicate, or even up to altogether.
3Automatically breaks data into packets.The splitting into packages and the delivery process is done manually.
4Will not send data too fast, so it gives guarantee internet connection can handle it.Must make certainty about the process of data transfer, in order not to be too fast so the internet can still handle it.
5Easy to use, transfer data packets such as writing and reading files.If the package is missing, it is important to consider where the error occurred and resend the required data.

If we are broadly speaking about the difference between TCP and UDP ports, the following is the second comparison table:

1It's reliable when the connection gets lost while sending a message. Then, the server will ask for the missing part. So, there will be no corrupt data when transferring a data.It's unreliable when sending a message or data. In which we will not know whether or not it has been sent and whether or not some of the messages are missing when the submission process. So there would be a possibility of corrupt data.
2It's sequential when sending two messages in sequence or one by one. TCP will send it in sequence. No need to worry about wrong order of data arriving.Not in sequence when sending two messages in sequence/one at a time. Uncertain about which data will come first.
3Connection-oriented. Before the data can be transmitted between two hosts, the two running processes on the application layer must negotiate to establish a connection session first. TCP connection is closed by using TCP connection termination process.Connectionless (no connection). UDP messages will be sent without having to negotiate the connection between two hosts who want to exchange information.
4Heavyweight. When the lowest level of TCP is reached in the wrong order, the request for data retransmission should be sent, and the rest must be returned. So it takes a process to unite itLightweight. No message requests, no connection trails and everything else, just run it and forget it. This means it's much faster, and the network card/OS just does a bit of work to translate back data from the packet.
5Data or packets streaming are read as one data flow. without knowing the limit of each data ends and other data starts. It is possible that some data packets are read by one data call.The packets diagrams are delivered individually and are guaranteed intact upon arrival. One packet is read by one call.
Examplese-mail (SMTP TCP, port 25 Postfix MTA), Secure Shell (OpenSSH, port 22), File Transfer Protocol (FTP, port 21), and World Wide Web (Apache TCP, port 80).Online multiplayer games, Domain Name System (DNS UDP, port 53), Voice over IP (VoIP), Trivial File Transfer Protocol (TFTP), and streaming media applications such as IPTV or movies.

Subscribe to Our Newsletter!

Love Skillonpage? Get exclusive personalised content right in your Inbox. It's free!

You may also read!

How to make a text reveal effect in Premiere Pro

How to Make a Text Reveal Effect in Premiere Pro CC

This article will guide you how to make a text reveal effect in Premiere Pro. Text Reveal effect is

How to Crop Video in Premiere Pro

5 Methods How to Crop Video in Premiere Pro CC

To begin how to crop video in Premiere Pro CC, add the video clip to the timeline by dragging

How to reduce video file size without losing quality.

How to Reduce a Video File Size Without Losing Quality in Premiere Pro

Hello guys! This tutorial will discover how to reduce video file size without losing quality through Premiere Pro export.


Leave a reply:

Your email address will not be published.

Mobile Sliding Menu