paint-brush
A beginner’s guide to ports.by@HoogleyBoogley
2,593 reads
2,593 reads

A beginner’s guide to ports.

by Danny TranOctober 12th, 2018
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

I’m sure that many of you guys have heard this term before, “port”, but what exactly does it mean in the world of computers? Well, a dictionary definition is an endpoint to a connection but that doesn’t really help much, so let’s break it down!

People Mentioned

Mention Thumbnail

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - A beginner’s guide to ports.
Danny Tran HackerNoon profile picture

I’m sure that many of you guys have heard this term before, “port”, but what exactly does it mean in the world of computers? Well, a dictionary definition is an endpoint to a connection but that doesn’t really help much, so let’s break it down!

Picture This

When most hear the word “port”, many may think of a harbor, so let’s use that to help us visualize.

So let’s say that our harbor is our router, connections come in, and connections come out. Now imagine the ships coming in and out of our harbor as internet traffic.

When a ship comes into our harbor, it will look for a specific place to dock, this specific place will represent our port number. One of the most common port is port 80, which is the port for web traffic. So our ship is entering our harbor looking for it’s assigned docking location, 80, if that port is open, our ship will come and dock. Awesome, our connection was made, but what if I don’t want a ship to dock? Well, in that case, we use something called a firewall to block certain ports. Our ship will approach our harbor and look for it’s assigned docking location, 80, but the port is blocked; the connection cannot be made and the shipping company, which represents the sender, might be notified depending on the protocol.

Protocols

There is two type of protocols in the realm of the internet, TCP and UDP.

TCP stands for Transmission Control Protocol, which is the most commonly used protocol on the internet. TCP will guarantee that all the packets are sent to the recipient by numbering them and sending them in order while the recipient will make sure that all of the packets are there, if it’s not, then the recipient will send a response to the sender and the sender will send all of those packets again to make sure they are all received.

On the other hand, UDP doesn’t make sure all of those packets are sent, but it will just keep sending them. The sender will only send the packets and will not wait for the recipient to send a response back, meaning there is a chance that some data can get lost in this transmission. So why would people choose this protocol? Speed. There are some applications where speed matters more than reliability, such as online games or live broadcasts.

Now we know what the protocols are, but how can we picture them to have a better understanding of them? Well, let’s say that our packets are shipping containers and the entire shipment is what’s being transmitted.

Let’s picture a ship unloading its containers, each container is numbered, is being taken off in order, and after every container is unloaded, inventory is taken to make sure that containers are getting unloaded in the correct order. If those containers are not unloaded in the correct order or a container is missing, the ship will be unloaded again to make sure no errors are made.

As for UDP, a ship will be unloaded as quickly as possible. If a container was not unloaded and left on the ship, the ship will leave and will not come back.

Conclusion

Thank you for taking the time to read my articles and I hope you’ve learned something new about ports. If you are interested in learning which port numbers correspond to which service, refer to this Wikipedia entry here.

If you enjoyed this article, please consider following me on other platforms of social media below:


Danny Tran (@hoogleyb) * Instagram photos and videos_321 Followers, 124 Following, 114 Posts — See Instagram photos and videos from Danny Tran (@hoogleyb)_www.instagram.com


Danny Tran (@HoogleyB) | Twitter_The latest Tweets from Danny Tran (@HoogleyB). Teenage software developer._twitter.com

And of course, I’m still human and I make mistakes so if you find any in this article, feel free to point it out in the comments.

Happy Coding!