Are you online? Of course you are! And that’s how you are reading this blog right now. Would you like to know how this is possible? This series is all about what it takes to be online and access internet!

Hey peeps, in this blog we’ll be talking about how transport layer port numbers are used to identify conversations and applications that are the destination and source.

TCP and UDP Port Numbers

When a server is set up, it may have many services or applications running on it. For example, mail server, web server, application server. When a message is received using either TCP or UDP, the protocols and service requests are identified by a port number. A port is a numeric identifier within each segment that is used to keep track of the conversation between a client and server. The messages that are sent by a host contains both a source and destination port. When a message is received by a server, it is necessary for the server to identify the service that is requested by the client.

Ports can broken into three categories and range in number from 1 to 65,535.

Well-known Ports

There are some standard services which are carried out in every server. Hence, the port numbers, below 1024 (range of 1 to 1023) are known as “well-known ports”. For example, a web server always listens to port 80, FTP server to port 21, mail server to port 25, etc. The ports with port number above 1024 will be used for other processes and assigned randomly.

Registered Ports

Ports ranging from 1024 to 49151 can be used as either source or destination ports. These can be registered by organizations to register for specific applications.

Private Ports

Ports ranging from 49152 to 65535 are often used as source ports. These ports can be used by any applications.

Some applications use both TCP and UDP. For example, DNS uses UDP when clients send requests to a DNS server. But the communication between two DNS servers always uses TCP.

Destination and Source Port Numbers

Source Port

It is associated with the originating application on the local host. The source port number is dynamically generated by the sending device to identify conversation between two devices. This process allows multiple conversations to occur simultaneously.

Destination Port

The client places a destination port number to the segment to tell the destination server what service is being requested.


The segments with the source and destination ports placed are encapsulated within an IP packet. Socket is used to identify the server and the service being requested by the client.

The combination of the source IP address and source port number, or the destination IP address and destination port number is known as a socket.

Sockets enable multiple processes, running on a client, to distinguish themselves from each other, and multiple connections to a server process to be distinguished from each other. The source port number acts as the return address for the requesting application.

Hope you got some idea about Ports, their types and how they are used. I’ll catch you up in the next blog.

Until then, Stay connected!!

“Buy me a coffee” is a global platform where millions of people support creators and artists, financially.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Sudarshan S

Tech enthusiast | Developer | Programmer | Cybersecurity | Machine learning | Data science