Transport Layer protocols (TCP and UDP) are responsible for supporting multiple network applications at the same instance and these applications can send and receive network data simultaneously. Transport Layer Protocols are capable of doing this by making use of application level addressing, known as port numbers. The data from different applications operating on a network device are multiplexed at the sending device using port numbers and demultiplexed at the receiving device, again using port numbers.
The two 16 bit fields in the TCP Header, Source port and Destination port identifies the port number which the application is listening at the sending device and receiving device. Since port number is a 16 bit number, the maximum possible value is 65535 ((2^16)-1).
To explain this concept more clearly, consider you are sitting comfortably at your home are using your laptop which is connected to internet. Consider you have only one network card attached to your laptop (so, you have only one MAC Address) and only one IP address. You are using a email client (Microsoft outlook or Mozilla Thunderbird), a web browser to view news online, a Java Chat application to chat with your online friends, and a Video sharing network utility, simultaneously. Devices located in the internet can see your laptop only as an IP address only.
Since you have only one MAC Address and IP address, how your TCP/IP protocol suit can find the exact application (which is waiting for its network data) to deliver the incoming data from internet for different network applications? What will happen if the incoming data for Video sharing utility is forwarded to Microsoft outlook or Mozilla Thunderbird email application?
Above questions are answered by port numbers. Each network application will bind itself to an available port number, so that TCP/IP protocol suit can identify the network application based on port numbers. So we can view port numbers as an application level address for network communication.
The port numbers are divided into three ranges.
The Well Known Ports are those in the range 0 – 1023. The Well Known Ports are assigned by the IANA (Internet Assigned Numbers Authority) for major protocols.
The Registered Ports are those in the range 1024 – 49151.
The Private Ports are those in the range 49152 – 65535.
|1||TCP Port Service Multiplexer (TCPMUX)|
|5||Remote Job Entry (RJE)|
|18||Message Send Protocol (MSP)|
|20||FTP – Data|
|21||FTP – Control|
|22||SSH Remote Login Protocol|
|25||Simple Mail Transfer Protocol (SMTP)|
|42||Host Name Server (Nameserv)|
|49||Login Host Protocol (Login)|
|53||Domain Name System (DNS)|
|69||Trivial File Transfer Protocol (TFTP)|
|108||SNA Gateway Access Server|
|115||Simple File Transfer Protocol (SFTP)|
|137||NetBIOS Name Service|
|139||NetBIOS Datagram Service|
|143||Interim Mail Access Protocol (IMAP)|
|150||NetBIOS Session Service|
|179||Border Gateway Protocol (BGP)|
|190||Gateway Access Control Protocol (GACP)|
|194||Internet Relay Chat (IRC)|
|197||Directory Location Service (DLS)|
|389||Lightweight Directory Access Protocol (LDAP)|
|396||Novell Netware over IP|
|444||Simple Network Paging Protocol (SNPP)|
Visit the following IANA link to know more about assigned ports.