Network Programming with Rust
local graph
Network Programming with Rust
Section titled “Network Programming with Rust”chapter_01
Section titled “chapter_01”node-book_network-programming-with-rust_chapter-01-introduction-to-client-server-networking — Introduction to Client/Server Networking
chapter_02
Section titled “chapter_02”node-book_network-programming-with-rust_chapter-02-introduction-to-rust-and-its-ecosystem — Introduction to Rust and its Ecosystem
chapter_03
Section titled “chapter_03”node-book_network-programming-with-rust_chapter-03-tcp-and-udp-using-rust — TCP and UDP Using Rust
chapter_04
Section titled “chapter_04”node-book_network-programming-with-rust_chapter-04-data-serialization-deserialization-and-parsing — Data Serialization, Deserialization, and Parsing
chapter_05
Section titled “chapter_05”node-book_network-programming-with-rust_chapter-05-application-layer-protocols — Application Layer Protocols
chapter_06
Section titled “chapter_06”node-book_network-programming-with-rust_chapter-06-talking-http-in-the-internet — Talking HTTP in the Internet
chapter_07
Section titled “chapter_07”node-book_network-programming-with-rust_chapter-07-asynchronous-network-programming-using-tokio — Asynchronous Network Programming Using Tokio
chapter_08
Section titled “chapter_08”node-book_network-programming-with-rust_chapter-08-security — Security
Rust has steadily become one of the most important new programming languages in recent years. Like C or C++, Rust enables the developer to write code that is low-level enough to make Rust code quickly. And since Rust is memory-safe by design, it does not allow code that can crash on a null pointer exception. These properties make it a natural choice for writing low-level networking applications. This book will enable developers to get started with writing networking applications with Rust.
This book’s target audience is a software engineer who is interested in writing networking software using Rust.
Chapter 1, Introduction to Client/Server Networking, starts the book with a gentle introduction to computer networking from the ground up. This includes IP addressing, TCP/UDP, and DNS. This forms the basis of our discussions in later chapters.
Chapter 2, Introduction to Rust and its Ecosystem, contains an introduction to Rust. This is an overall introduction that should be good enough to get the reader started. We do assume some familiarity with programming.
Chapter 3, TCP and UDP Using Rust, dives into using Rust for networking. We start with basic socket programming using the standard library. We then look at some crates from the ecosystem that can be used for network programming.
Chapter 4, Data Serialization, Deserialization, and Parsing, explains that an important aspect of networked computing is handling data. This chapter is an introduction to serializing and deserializing data using Serde. We also look at parsing using nom and other frameworks.
Chapter 5, Application Layer Protocols, moves up a layer to look at protocols that operate above TCP/IP. We look at a few crates to work with, such as RPC, SMTP, FTP, and TFTP.
Chapter 6, Talking HTTP in the Internet, explains that arguably the most common application of the internet is HTTP. We look at crates such as Hyper and Rocket which are used for writing HTTP servers and clients.
Chapter 7, Asynchronous Network Programming Using Tokio, looks at the Tokio stack for asynchronous programming using futures, streams, and event loops.
Chapter 8, Security, delves into securing the services we have described so far. This is using certificates and secret keys.
Chapter 9, Appendix, discusses a number of crates have appeared that propose alternate ways of doing things already covered in this book. This includes the async/await syntax, parsing using Pest, and so on. We will discuss some of these in the appendix.
- They are either already familiar with Rust or are planning to start learning the language.
- They have a commercial background in software engineering using other programming languages and are aware about the tradeoffs in developing software using different programming languages.
- They have a basic familiarity with networking concepts.
- They can appreciate why distributed systems are important in modern computing.
You can download the example code files for this book from your account at www.packtpub.com. If you purchased this book elsewhere, you can visit www.packtpub.com/support and register to have the files emailed directly to you.
You can download the code files by following these steps:
- Log in or register at www.packtpub.com.
- Select the SUPPORT tab.
- Click on Code Downloads & Errata.
- Enter the name of the book in the Search box and follow the onscreen instructions.
Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:
- WinRAR/7-Zip for Windows
- Zipeg/iZip/UnRarX for Mac
- 7-Zip/PeaZip for Linux
The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Network-Programming-with-Rust.
There are a number of text conventions used throughout this book.
CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: “The target directory contains compilation artifacts.”
A block of code is set as follows:
[package]name = "hello-rust"version = "0.1.0"authors = ["Foo Bar <[email protected]>"]Any command-line input or output is written as follows:
# cargo new --bin hello-rustBold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: “It will not need to call connect for that same connection:”
Warnings or important notes appear like this.
Tips and tricks appear like this.
Feedback from our readers is always welcome.
Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!
For more information about Packt, please visit packtpub.com.
Source: