6.6.1 TCP/IP at the code layer

Engineers represent communications protocols (including internet protocols) in layers like Lessig's three-layers model of the internet. In reality the operation of the internet is slightly more complex than the three-layers model might lead us to believe. To look at TCP/IP, we are going to further refine Lessig's model and consider TCP and IP as operating at two different levels or sub-layers within the code/logical layer as follows:

Packets travel vertically up and down through the layers. The various protocols which operate at each level do their stuff with the packets as they arrive and then pass them on to the next layer/protocol. For this reason the TCP/IP software running on a computer is often called a ‘TCP/IP stack’.

The network (IP) layer figures out how to get packets to their destination. This is where IP lives. It gives no guarantees about whether packets will get through, it just decides where they will be sent. With incoming packets, on a receiving computer, it checks to see if a packet is corrupted and, if it is, discards it. If the packet is OK the network layer passes it on to the transport layer.

The transport layer is where TCP lives. Its job is to ensure the reliability and integrity of messages, and to process them to and from the adjoining layers. So, for example, on the receiving computer, TCP checks all the packets in, uses the information on their address labels to reassemble them in the correct order and asks for any that have been lost in the post to be re-transmitted then passes the assembled message to the application layer for display on the computer screen.

6.6 How TCP/IP works

6.6.2 How a stack works