Networking for Developers – part 1: overview
For some reason grasping the concepts around computer networks has always been hard for me. Not surprisingly, I find that I’m not the only one: many software developers don’t really understand how computers networks… work. All I know is that I send stuff via the internet and my stuff gets where I wanted it to go. But how does that happen? Magic?
Obviously, no! So, I’m attempting to learn more about networks and more importantly, learn how to troubleshoot when things don’t go as expected. My goal here is to share some of the things I am learning. I hope it helps someone else too.
Basic Concepts
NETWORKING: connecting computers and sending data between them.
Data is transmitted over a network in small chunks called PACKETS, which have two parts:
- HEADER: all the identification info such as origin host, destination host and basic protocol.
- PAYLOAD: the actual data, for example some HTML or an image.
The operating system takes care of translating between packets and the data that your application uses.
A fully functional network includes a set of network layers that combined are called network stack.
NOTE: You might have heard of the seven network layers from the OSI (Open Systems Interconnection) model. The OSI model is more often used in teaching and designing networks. For the Internet, the four layers below are enough to explain how that network works.
The network stack has four layers and I will give you a tip to remember these layers. It’s A TIP… Got it? ATIP ? From top to bottom:
- Application layer: the layer that the user interacts with (such as web browsers). It uses high-level protocols that computer applications and servers use to communicate (HTTP, SSL, FTP, etc)
- Transport layer: transmission of data, including data integrity checks, source and destination ports and specifications to break the data down into packets (in case the application layer hasn’t done that yet). TCP and UPD are the most common transport layer protocols.
- Internet (or Network) layer: defines how to move packets from a source host to a destination host. For the Internet, this is the Internet Protocol (IP)
- Physical layer (or Link): defines how to send raw data across physical medium, such as Ethernet or modem.
There! ATIP! 😛
So, data going from host A to host B goes through all these layers, like this:
The lower layers in the stack (Internet/Network and Physical) will help the sending computer know WHERE to send the data and the upper layers (Application and Transport) will help the destination computer to figure out WHAT is the data that it just received:
I will cover each layer separately in future posts. 🙂
UPDATE: Coming up next:
The post Networking for Developers: part 1: overview was originally published at flaviabastos.ca