Building Protocols on Top of TCP
In the previous chapter, we used the Tokio framework to support an async actor model. Our Tokio framework accepted basic traffic and then sent those messages to actors once the messages were processed. However, our TCP processing was basic. You should not be comfortable building complex systems on this basic TCP process if this book is the only exposure you have had to TCP. In this chapter, we will completely focus on how to package, send, and read data over a TCP connection.
In this chapter, we will cover the following topics:
- Setting up a TCP client and echo server
- Processing bytes over TCP using structs
- Creating frames to separate messages over TCP
- Building an HTTP frame on top of TCP
By the end of this chapter, you will be able to package, send, and read data sent over TCP using a range of different approaches. You will be able to understand how to split your data into frames that can be handled as structs. Finally...