Of equal importance to understanding a technique in-depth is understanding when not to apply it. Let's consider another thread-per-unit-of-work system, but this time we'll be echoing Ethernet packets rather than lines received over a TCP socket. Our project's Cargo.toml:
[package] name = "sniffer" version = "0.1.0" authors = ["Brian L. Troutwine <brian@troutwine.us>"] [dependencies] pnet = "0.21" [[bin]] name = "sniffer" [[bin]] name = "poor_threading"
Like the TCP example, we'll create two binaries, one that is susceptible to thread overload–poor_threading–and another–sniffer–that is not. The premise here is that we want to sniff a network interface for Ethernet packets, reverse the source and destination headers on ...