The port number is used by by the system to identify what application the data came from or destined to. In the case of FTP, the ftp server is going to expect communication on top port 21. When network traffic is processed, it will look at the port number in the tcp header and hand it off to the ftp service.
Commonly used applications will have ports registered with IANA and can be searched for. Generally these ports are between 1 and 2000.
That said, the port numbers are mostly arbitrary. You don’t have to run ftp on port 21, you can run it on any port not in use by the system. If you do you might run into issues with programs expecting a common service to be running on a known port if it’s hard coded, and there potential security issues to take into consideration.
Latest Answers