Summary
In this chapter, we reviewed the basics of networking in Linux/Unix. We learned about the networking primitives in the Rust standard library, including data structures for IPv4 and IPv6 addresses, IPv4 and IPv6 sockets, and associated methods. We learned how to create addresses, as well as create sockets and query them.
We then learned how to use UDP sockets and wrote a UDP client and server. We also reviewed the TCP communication basics, including how to configure TCP listeners, how to create a TCP socket server, and how to send and receive data. Lastly, we wrote a project consisting of two servers – an origin server and a reverse proxy server that routes requests to the origin server.
In the next and final chapter of the book, we'll cover another important topic for system programming – unsafe Rust and FFI.