In a number of cases, a protocol has a data unit with a header attached to it. The server typically reads the header first and, based on that, decides how to process the data. In some cases, the server may be able to do some processing based on the header. One such example is IP, which has a header that has the destination address. A server may start running a longest prefix match based on that information, before reading the body. In this section, we will look into using tokio to write such servers. We will expand our toy collatz protocol to include a header and some data body, and work from there. Let us start with an example, and our project setup will be exactly the same, setting it up using Cargo:
$ cargo ...