DEV Community

Discussion on: Explain TCP like I'm five

Collapse
 
0x424c41434b profile image
0x424c41434b

I think additionally I could try and expand on this.

TCP is built on

Network Layer connection = how are we physically transporting this sugar
Internet Layer = Who is exchanging this sugar
Transport Layer = Which cup is this sugar going to

Network layer = responsible for physically transporting this data which is (e.g)
someone walking over or even throwing over the sugar to the person that is requesting it.
This can come in many forms such as ethernet or wifi(simplified). Are you throwing the sugar or are you physically walking there.

Internet Layer = You need to know where these packages are going, These layers usually have frames that contain destination IP and source IPs.
The source IP would be where the packet or sugar is coming from(which person) and where the packet should go destination IP(where the sugar is going)
This would be from a host to host level, we do not know which of the cups the sugar is going into

Transport Layer = Imagine the person asking for the sugar has got three cups. We need to know which cup the sugar is going into. for this purpose we describe the cups as having their port addresses.
Putting the sugar into the designated cup would be transporting from an process to process level transportation.

Transport layer will have different methods of transporting the sugar as it was mentioned. Which would be where I would reference the first comment posted of UDP vs TCP

Collapse
 
ben profile image
Ben Halpern

What's the technical purpose for differentiating the Internet Layer and the Transport Layer? Why can't one "layer" handle IP and ports?

Collapse
 
tgiddings profile image
Trevor Giddings

separating out being able to figure out where a packet goes (internet layer) from anything about it's contents and purpose (transport layer) allows the infrastructure of the internet to be much simpler. It also means that only the machines communicating with each other need to be concerned with what's being sent and why, and developers can create new transport protocols tailored to their use (though this is usually not a good idea since people end up creating a nock-off tcp).

as an analogy: if the transport layer is the methodology for deciding when and how to chuck packets at each other, the internet layer is the muscles in your arms. They only need to be specialized enough to move the arms. They don't need to be concerned with the manner of packet chucking, nor should they be in case you want to chuck packets differently.

Collapse
 
jacoby profile image
Dave Jacoby

Layers of misdirection, and I might have to redo this before I can get to the five-year-old level.

My group is in the coffee shop, and there's enough people to require a few tables, and my table runs out. The people at my table know me, and know Dave = "seat nearest the bathroom". This part is MAC address to to IP address, which is done by Address Resolution Protocol, or ARP, and you can use computers your whole life without caring about this.

But next table over doesn't know me or where I sit, so when you ask them (serving as gateway) to pass some sugar, it is the job of the IP layer to handle the sugar-to-table part and the transport to know who to pass it to here.

Plus, on some tables, people just pass left, or right, but some might throw it right to me over the air. Actually, "how it goes" is more the job of transport layer, although which-one's-Dave is part of that.

Collapse
 
0x424c41434b profile image
0x424c41434b

I am not sure of any accepted answer but one reasoning for this separation would be for applications that only implement up to one layer.

If there is a router that only implements up to the internet layer(because it doesn't need port control up to that point) it would easily be able to implement this functionality up the internet layer only.

This also proves the same for software that would only implement up to the network layer such as old switches

Thread Thread
 
antoinette0x53 profile image
Antoinette Maria

I agree with this. I'd also expand on this and say that different devices "unwrap" different layers of a packet. So yeah, it wouldn't necessarily make sense for an edge router to care what port is needed. It just needs to know where to send the packet (IP) and the target machine handles the rest.