Knowledge Test Score Board
— · 0%
Work through the questions below — your score updates as you go.
Keep going · grade bands mapped to DCU's honours scale
Only your first attempt at each question counts toward this score. Reload the page to reset.
This section contains 20 interactive knowledge checks designed to test your understanding of the materials covered in Chapter 11. The questions cover TCP/IP fundamentals, network socket programming in Rust using TcpListener and TcpStream, building robust client-server architectures, and an introduction to advanced protocols like MQTT and HTTP for the IoT Edge.
Please remember that many of the quizzes have multiple correct answers , and you must select all applicable options to succeed. I have carefully balanced the lengths of the answers, so take your time to evaluate each option thoroughly.
Good luck!
Derek.
Concept Match
Match the Networking Layers derekmolloy.ie Drag each definition into its matching concept slot, then click Submit. Tap × to return a placed card to the pool.
Definition Pool
A unique numerical label assigned to each device connected to a computer network.
A 16-bit integer used to identify specific processes or services on a single device.
A connection-oriented protocol that ensures reliable, ordered, and error-checked delivery.
A connectionless protocol prioritising speed and low overhead over guaranteed reliability.
Submit
Why is TCP generally preferred over UDP for critical control applications on edge devices, such as industrial PLC units? derekmolloy.ie
Because TCP uses a stateless architecture that allows it to operate without a permanent network connection.
Because TCP automatically handles packet retransmission and ensures that data arrives in the correct sequence.
Because TCP provides a smaller binary footprint, which is essential for devices with extremely limited flash memory.
Because TCP includes built-in flow control to prevent a fast sender from overwhelming a slower receiver. Submit Answer
Regarding network 'Sockets', which of the following statements accurately describes their role in software development? derekmolloy.ie
They are defined by the combination of an IP address and a 16-bit port number (e.g., 127.0.0.1:8080).
They are restricted to communicating only between different physical machines across a local area network.
They represent the software endpoint of a bidirectional communication link between two programs.
They are physical hardware connectors found on the motherboard of high-performance edge gateways. Submit Answer
Drag snippets from the pool into the blanks so the program produces the output shown, then click Submit.
1 fn main() {
2 // The standard 'loopback' address for testing on the same machine
3 let local_addr = " ····· ";
4
5 // A common port number for development servers
6 let port = " ····· ";
7
8 let socket_addr = format!("{}:{}", local_addr, port);
9 }
Available Snippets
localhost
80
8080
192.168.1.1
127.0.0.1
0.0.0.0
Submit
Concept Match
Match the Rust Networking Types derekmolloy.ie Drag each definition into its matching concept slot, then click Submit. Tap × to return a placed card to the pool.
Definition Pool
The error type returned by networking operations, covering timeouts and broken pipes.
Represents a single active connection, allowing for bidirectional data transfer.
An iterator that yields new connection attempts as they arrive at the listener.
A structure that binds to a port and waits for incoming connection requests.
Submit
Predict the output: Binding to a Port derekmolloy.ie Read the code below, then choose the terminal output it produces and click Submit.
1 use std::net::TcpListener;
2
3 fn main() {
4 // Attempt to listen on port 80 (requires admin/root)
5 match TcpListener::bind("127.0.0.1:80") {
6 Ok(_) => println!("Success"),
7 Err(e) => println!("Error: {}", e.kind()),
8 }
9 }
stdout
Error: PermissionDenied
stdout
Error: ConnectionRefused Submit Answer
When using the listener.incoming() iterator, what exactly is yielded for each successful connection? derekmolloy.ie
A raw byte buffer containing the initial packet data from the client.
A Result type that must be unwrapped to handle potential connection failures.
The client's IP address and port number as a formatted String.
A TcpStream object representing the active communication channel. Submit Answer
Writing to a Network Stream derekmolloy.ie Drag snippets from the pool into the blanks so the program produces the output shown, then click Submit.
1 use std::io::Write;
2 use std::net::TcpStream;
3
4 fn main() -> std::io::Result<()> {
5 let mut stream = TcpStream::connect("127.0.0.1:8080")?;
6
7 let message = "Status: OK";
8 // Convert the string to a byte slice and send it
9 stream. ····· (message. ····· ())?;
10
11 Ok(())
12 }
Available Snippets
as_bytes
into_bytes
write_all
send
to_string
push
Submit
In a typical edge sensor network, which entity usually assumes the 'Server' role? derekmolloy.ie
The central gateway or desktop dashboard that 'listens' for incoming data packets.
The network router that manages the IP address allocation via DHCP.
The individual battery-powered sensor node waiting for a command to sample data.
The cloud-based database that stores historical readings for long-term analysis. Submit Answer
Drag the tiles to arrange the code in the correct order, then click Submit. Locked lines stay in place. Indentation is dynamically applied based on the location of braces.
let listener = TcpListener::bind("127.0.0.1:8080").unwrap();for stream in listener.incoming() {
let mut stream = stream.unwrap();
let mut buffer = [0; 512];
stream.write_all(b"ACK").unwrap();
stream.read(&mut buffer).unwrap();Submit Order
Why is it crucial to spawn a new thread (or use async tasks) for each incoming connection in a production TCP server? derekmolloy.ie
Because the Rust standard library requires a thread-per-connection for memory safety verification.
To prevent a single slow client from blocking the main listener loop and stalling other incoming connections.
To allow the server to utilise multiple CPU cores for processing independent client requests in parallel.
To ensure that the client's IP address is correctly registered in the system's global routing table. Submit Answer
Concurrent Connection Handling derekmolloy.ie Drag snippets from the pool into the blanks so the program produces the output shown, then click Submit.
1 for stream in listener.incoming() {
2 let stream = stream.unwrap();
3 // Offload each connection to its own thread
4 std::thread:: ····· ( ····· || {
5 handle_client(stream);
6 });
7 }
Available Snippets
async
ref
run
move
spawn
create
Submit
Concept Match
Match the Data Representation derekmolloy.ie Drag each definition into its matching concept slot, then click Submit. Tap × to return a placed card to the pool.
Definition Pool
A popular text-based format for structured data, widely supported by web APIs.
The byte order (Big vs Little) used to represent multi-byte values in a binary stream.
Compact, efficient data representation (e.g., raw structs) ideal for bandwidth-limited radio links.
Human-readable data (e.g., CSV or custom strings) easy to debug but higher overhead.
Submit
Which crate is the 'gold standard' for serialising and deserialising Rust data structures for network transmission? derekmolloy.ie
In binary networking, why is 'Network Byte Order' (Big-Endian) historically significant? derekmolloy.ie
Because it is the only format supported by the standard Rust i32 and f64 types.
Because it provides a standard, consistent way to represent numbers across systems with different native architectures.
Because it automatically compresses the data by 50% during transmission across wireless links.
Because it was the native format of the original 8-bit Intel processors used in the first edge sensors. Submit Answer
Safe Buffer Initialisation derekmolloy.ie Drag snippets from the pool into the blanks so the program produces the output shown, then click Submit.
1 fn handle_read(mut stream: TcpStream) {
2 // Create an empty byte buffer of 1024 bytes
3 let mut buffer = [ ····· ; 1024];
4
5 // Read data from the stream into the buffer
6 let bytes_read = stream. ····· (&mut buffer).unwrap();
7
8 // Convert the received bytes into a UTF-8 string slice
9 let msg = std::str::from_utf8(&buffer[.. ····· ]).unwrap();
10 }
Available Snippets
u8
read
bytes_read
1024
recv
len
0
Submit
Concept Match
Match the IoT Protocols derekmolloy.ie Drag each definition into its matching concept slot, then click Submit. Tap × to return a placed card to the pool.
Definition Pool
A protocol providing full-duplex, persistent communication over a single TCP connection.
A request-response protocol primarily used for web services and large document transfers.
A specialised protocol for restricted nodes and networks, similar to HTTP but over UDP.
A lightweight publish-subscribe protocol ideal for low-power sensors and unreliable networks.
Submit
What is the primary benefit of the 'Publish-Subscribe' model used in MQTT compared to traditional HTTP? derekmolloy.ie
It decouples data producers from consumers, allowing for extremely efficient one-to-many communication.
It requires every device to have a public IP address to receive incoming notifications.
It provides a way for low-power sensors to receive data without knowing the specific identity of the sender.
It forces devices to stay awake and connected at all times, ensuring 100% data reliability. Submit Answer
Why is 'Asynchronous Networking' (e.g., using the Tokio crate) preferred for high-concurrency edge gateways? derekmolloy.ie
Because it is the only way to send data over encrypted TLS channels in the Rust ecosystem.
Because it allows the CPU to run significantly faster by bypassing the standard hardware interrupt system.
Because it enables a single OS thread to handle thousands of active connections by yielding during I/O wait times.
Because it eliminates the memory overhead of maintaining thousands of separate OS thread stacks. Submit Answer
In a bare-metal (#![no_std]) environment like an ESP32 microcontroller, how is networking typically handled? derekmolloy.ie
By utilising specialised crates like 'embedded-nal' (Network Abstraction Layer) and vendor-specific HALs.
By using the standard library's std::net module, which is fully compatible with all wireless chips.
By bypassing the IP stack entirely and manually toggling the radio antenna pins at high frequency.
By running a full Linux kernel in a background task to provide the necessary socket support. Submit Answer
Congratulations on completing the Chapter 11 Knowledge Test!
Review any questions you missed to ensure a solid grasp of Rust networking and client-server communication before exploring the final chapters on resource management and optimization.