Summary

This chapter was a short introduction to the basic networking functionality in Rust. We started with given functionality in std::net, and we wrote a few TCP and UDP servers using those. We then looked at some other utilities in the same namespace. At the end, we went over examples of a number of crates which are aimed at extending the standard library's functionality around networking. Bear in mind that it is always possible to just use the libc crate to write networking code, which is based on POSIX-compatible networking code with access to fine-grained control over sockets and network devices. The problem with this approach is that the code might be unsafe, breaking Rust's guarantee of safety. Another crate called nix aims to provide ...

Get Network Programming with Rust now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.