Have you ever stopped to think about how information is transmitted from computer to computer?
It's mind-blowing and we do it all the time โ from making fetch
calls in our applications to the daily usage of our computers.
Let's contextualize this exploration through the lens of RESTful protocols. Our data, like an email that we'd like to send to a friend, is broken up into "packets" that are transmitted from one computer and rebuilt on the receiving computer. Let's follow an email from your computer with an IP address of 1.2.3.4 as it traverses the internet to your friend's computer at IP address of 5.6.7.8.
We start from the top left corner of the diagram and work our way to the upper right hand corner:
- The application layer is where we navigate to https://gmail.com to compose and send an email. If your message is too long, it will be broken up into packets as we enter the TCP layer of the networking protocol stack.
- At the TCP layer, packets are assigned to port numbers based on the data type. The IANA governs and documents these conventions. For purposes of this introductory post, our takeaway should be that our packets are assigned to the appropriate port number for the receiving computer.
- At the IP layer, our packets receive the destination address (e.g*., IP address of 5.6.7.8*).
- Finally, we arrive at the hardware layer (e.g., ethernet cables) where our encapsulated alphanumeric data (i.e., strings) is transformed into electronic signals and gets sent across phone/cable lines โ or light, if you have fiber.
Similarly to how UPS or USPS would route your online order from a warehouse overseas to your doorstep, your email packet traverses the internet in milliseconds to your figurative doorstep. Once arrived at 5.6.7.8, we reverse the steps outlined above. And with the help of checksums (a computation to confirm that no packets are missing or tampered with), the packets we sent are collected and reassembled on our friend's computer.
From a technical perspective, the data contained within (i.e., the email or picture) is very much the same. For those that are philosophically inclined, is the reassembled email really the same as what you sent?
In a future post, I would like to explore the OSI/TCP-IP model in more detail to explore topics such as security and performance to help us become better coders.
Top comments (0)