codedamn logo
codedamn

The Story of Ports | How SSH, HTTPS, Redis, MongoDB Work

  • Vishnupriya's profile image
    Vishnupriya
    Team codedamn
The Story of Ports | How SSH, HTTPS, Redis, MongoDB Work

Today we are focused on port numbers, what are they, and why are they important. For this, it is advised to use a proper Linux computer that has the full working Linux environment. If you do not have it no need to worry! Codedamn got you all covered! Just go to Codedamn’s playground and you will be able to work with a full-fledged Linux environment in no time!

What is a port?

Computers run a lot of software on your system. In order for this software to work, they communicate to other computers or communicate internally over an HTTP. This can only happen over certain allocated ports. Hence if your computer is a house. Then you can consider ports as small windows in your house. So via the door or window that is through the port traffic enters and exits. 

If you build a port that you only use internally that is called localhost. You also have ports that are exposed to the internet. These ports allow other people to send and receive traffic from your computer.

How do port numbers work?

First, the default command is

Static-server -p 1337 –no-cache

The no-cache is to avoid caching by the static server. The moment we run this default command it states that it saves the serving files at localhost 1337. This means the port 1337 has been exposed within this computer itself. Hence you can use it and you can use it as your own computer’s server. You can also get your hands on this application by using the port number. Note that you can not use a server that is already occupied.

Conclusion

At Codedamn we provide localhost at multiple port numbers and the link is sharable. Hope you understood the importance of port numbers, what they are, and how useful they can be for all of us developers!

User avatar