Understanding networking primitives in the Rust standard library
In this section, we'll discuss the foundational data structures in the Rust standard library for networking. Figure 11.3 lists the commonly used data structures:
Let's look at the data structures one by one:
Ipv4Addr
: This is a struct that stores a 32-bit integer representing an IPv4 address, and provides associated functions and methods to set and query address values.Ipv6Add
: This is a struct that stores a 128-bit integer representing an IPv6 address, and provides associated functions and methods to query and set address values.SocketAddrv4
: This is a struct representing an internet domain socket. It stores an IPv4 address and a 16-bit port number and provides associated functions and methods to set and query socket values.SocketAddrv6
: This is a struct representing an internet domain...