TCP/IP Lean: Web Servers for Embedded Systems, Second Edition

A journey through TCP/IP starts with the lower layers and works upward so that you can experiment en route to check your understanding. I'll start with Internet Protocol (IP) and the associated Internet control message protocol (ICMP), which are low-level interfaces between TCP/IP and the network drivers.
First I'll place IP and ICMP into the context of the overall TCP stack and sketch the roles of other protocols (such as TCP) that I will describe in future chapters. Then I'll look at the details of IP and ICMP, the way in which the IP messages (datagrams) are stored within software, and implement the standard diagnostic utility, Ping.
To consolidate your understanding of IP and the concept of routing, I'll develop a simple router that can support multiple Ethernet and serial interfaces.
I have already discussed the concept of a protocol stack containing protocol layers, and I have referred to TCP/IP as a protocol family. It is now time to be more specific and start working the way up a TCP/IP stack (Figure 4.1).
The first software layer above the network drivers is IP and its partner ICMP. Above these, there is a split: connection-oriented applications use transmission control protocol (TCP), whereas connectionless applications use user datagram protocol (UDP). I have illustrated this using two examples of each type, though the actual number of applications is far greater.
If you employ TCP, you get a logical connection between your application and the remote...